#include <bits/stdc++.h>
#define endl '\n'
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define fo(i,n) for(auto i =0 ; i < n;i++)
#define fore(i,l,r) for(auto i = l; i < r;i++)
#define forex(i,r,l) for(auto i = r; i >= l; i--)
#define ffo(i,n) forex(i,n-1,0)
#define all(x) x.begin(),x.end()
#define lsb(x) x&(-x)
#define sz(x) (int)x.size()
#define gcd(a,b) __gcd(a,b)
#define vii vector<ii>
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>;using ii = pair<int,int>;using mii = map<int,int>;
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
const int N = 3e5 + 5;
vi graph[N];int n,k;
int vis[N], timer = 0;
void init(int N, int K){n=N,k=K;}
bool ya = 0;
int add_teleporter(int u, int v){
if(ya) return 1;
graph[u].pb(v);
fore(i,1,k+1){timer++;
queue<int> q;q.push(i);
int mn =1e9;
while(!q.empty()){
int nodo = q.front();q.pop();
for(int v : graph[nodo]){
if(vis[v] == timer) continue;
vis[v] = timer;
q.push(v);
mn= min(mn, v);
}
}
if(mn<=i){ya=1;
return 1;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
8280 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
8280 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
8280 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
8280 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
8280 KB |
Wrong Answer[1] |
2 |
Halted |
0 ms |
0 KB |
- |