#include "game.h"
#include <bits/stdc++.h>
#define all(x) begin((x)), end((x))
using ll = long long;
using namespace std;
vector<vector<int>> g(1001);
ll planets, specials;
void init(int n, int k) {
planets = n, specials = k;
for (int i = 0; i < k - 1; i++) g[i].push_back(i + 1);
}
int add_teleporter(int u, int v) {
g[u].push_back(v);
vector<bool> vis(1001);
queue<ll> q;
q.push(0);
while (q.size()) {
ll curr = q.front();
q.pop();
if (vis[curr] && curr < specials) return true;
else if (vis[curr])
continue;
vis[curr] = true;
for (const int& nei : g[curr]) q.push(nei);
}
return false;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |