#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);
fo(i,k){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 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
4 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
4 ms |
8280 KB |
Output is correct |
6 |
Correct |
4 ms |
8280 KB |
Output is correct |
7 |
Correct |
4 ms |
8280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
4 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
4 ms |
8280 KB |
Output is correct |
6 |
Correct |
4 ms |
8280 KB |
Output is correct |
7 |
Correct |
4 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
3 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
3 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
3 ms |
8280 KB |
Output is correct |
15 |
Correct |
3 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
2 ms |
8280 KB |
Output is correct |
19 |
Correct |
3 ms |
8280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
4 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
4 ms |
8280 KB |
Output is correct |
6 |
Correct |
4 ms |
8280 KB |
Output is correct |
7 |
Correct |
4 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
3 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
3 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
3 ms |
8280 KB |
Output is correct |
15 |
Correct |
3 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
2 ms |
8280 KB |
Output is correct |
19 |
Correct |
3 ms |
8280 KB |
Output is correct |
20 |
Correct |
4 ms |
8280 KB |
Output is correct |
21 |
Correct |
2 ms |
8280 KB |
Output is correct |
22 |
Correct |
5 ms |
8280 KB |
Output is correct |
23 |
Correct |
3 ms |
8280 KB |
Output is correct |
24 |
Correct |
302 ms |
8480 KB |
Output is correct |
25 |
Correct |
638 ms |
8536 KB |
Output is correct |
26 |
Correct |
890 ms |
9040 KB |
Output is correct |
27 |
Correct |
556 ms |
8496 KB |
Output is correct |
28 |
Correct |
53 ms |
8536 KB |
Output is correct |
29 |
Correct |
339 ms |
8488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
4 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
4 ms |
8280 KB |
Output is correct |
6 |
Correct |
4 ms |
8280 KB |
Output is correct |
7 |
Correct |
4 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
3 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
3 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
3 ms |
8280 KB |
Output is correct |
15 |
Correct |
3 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
2 ms |
8280 KB |
Output is correct |
19 |
Correct |
3 ms |
8280 KB |
Output is correct |
20 |
Correct |
4 ms |
8280 KB |
Output is correct |
21 |
Correct |
2 ms |
8280 KB |
Output is correct |
22 |
Correct |
5 ms |
8280 KB |
Output is correct |
23 |
Correct |
3 ms |
8280 KB |
Output is correct |
24 |
Correct |
302 ms |
8480 KB |
Output is correct |
25 |
Correct |
638 ms |
8536 KB |
Output is correct |
26 |
Correct |
890 ms |
9040 KB |
Output is correct |
27 |
Correct |
556 ms |
8496 KB |
Output is correct |
28 |
Correct |
53 ms |
8536 KB |
Output is correct |
29 |
Correct |
339 ms |
8488 KB |
Output is correct |
30 |
Correct |
161 ms |
9388 KB |
Output is correct |
31 |
Correct |
217 ms |
8784 KB |
Output is correct |
32 |
Correct |
111 ms |
9660 KB |
Output is correct |
33 |
Correct |
25 ms |
9808 KB |
Output is correct |
34 |
Execution timed out |
4032 ms |
9928 KB |
Time limit exceeded |
35 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
8280 KB |
Output is correct |
2 |
Correct |
2 ms |
8280 KB |
Output is correct |
3 |
Correct |
4 ms |
8280 KB |
Output is correct |
4 |
Correct |
2 ms |
8280 KB |
Output is correct |
5 |
Correct |
4 ms |
8280 KB |
Output is correct |
6 |
Correct |
4 ms |
8280 KB |
Output is correct |
7 |
Correct |
4 ms |
8280 KB |
Output is correct |
8 |
Correct |
2 ms |
8280 KB |
Output is correct |
9 |
Correct |
3 ms |
8280 KB |
Output is correct |
10 |
Correct |
2 ms |
8280 KB |
Output is correct |
11 |
Correct |
3 ms |
8280 KB |
Output is correct |
12 |
Correct |
2 ms |
8280 KB |
Output is correct |
13 |
Correct |
2 ms |
8280 KB |
Output is correct |
14 |
Correct |
3 ms |
8280 KB |
Output is correct |
15 |
Correct |
3 ms |
8280 KB |
Output is correct |
16 |
Correct |
2 ms |
8280 KB |
Output is correct |
17 |
Correct |
3 ms |
8280 KB |
Output is correct |
18 |
Correct |
2 ms |
8280 KB |
Output is correct |
19 |
Correct |
3 ms |
8280 KB |
Output is correct |
20 |
Correct |
4 ms |
8280 KB |
Output is correct |
21 |
Correct |
2 ms |
8280 KB |
Output is correct |
22 |
Correct |
5 ms |
8280 KB |
Output is correct |
23 |
Correct |
3 ms |
8280 KB |
Output is correct |
24 |
Correct |
302 ms |
8480 KB |
Output is correct |
25 |
Correct |
638 ms |
8536 KB |
Output is correct |
26 |
Correct |
890 ms |
9040 KB |
Output is correct |
27 |
Correct |
556 ms |
8496 KB |
Output is correct |
28 |
Correct |
53 ms |
8536 KB |
Output is correct |
29 |
Correct |
339 ms |
8488 KB |
Output is correct |
30 |
Correct |
161 ms |
9388 KB |
Output is correct |
31 |
Correct |
217 ms |
8784 KB |
Output is correct |
32 |
Correct |
111 ms |
9660 KB |
Output is correct |
33 |
Correct |
25 ms |
9808 KB |
Output is correct |
34 |
Execution timed out |
4032 ms |
9928 KB |
Time limit exceeded |
35 |
Halted |
0 ms |
0 KB |
- |