#include <bits/stdc++.h>
#include "game.h"
using namespace std;
typedef long long ll;
#define pb push_back
#define maxn 300005
int N, K;
vector<int> adj[maxn];
void init(int n, int k){
N = n, K = k;
for(int i = 0; i < k - 1; ++i) adj[i].pb(i + 1);
}
int add_teleporter(int u, int v){
if(u == v){
if(u <= K) return 1;
return 0;
}
adj[u].pb(v);
vector<bool> vis(N, 0);
queue<int> bfs;
bfs.push(0), vis[0] = 1;
while(bfs.size()){
int u = bfs.front(); bfs.pop();
for(auto v:adj[u]){
if(vis[v]){
if(v <= K) return 1;
continue;
}
bfs.push(v);
vis[v] = 1;
}
}
return 0;
}
/*
int main(){
int n, m, k; cin >> n >> m >> k;
init(n, k);
bool ok = 1;
for(int i = 0; i < m; ++i){
int u, v; cin >> u >> v;
int r = add_teleporter(u, v);
if(r) {
cout << i << '\n';
ok = 0;
break;
}
}
if(ok) cout << m << '\n';
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |