#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#include "game.h"
int N,K;
vi adjList[300000];
int mm[300000];
void init(int n,int k) {
int i;
N = n,K = k;
for (i = 0; i < k-2; i++) adjList[i].pb(i+1);
for (i = 0; i < n; i++) mm[i] = (i < k) ? i:-1;
}
int add_teleporter(int u,int v) {
queue<int> Q;
if ((v < K) && (mm[u] >= v)) return 1;
adjList[u].pb(v);
if (mm[u] > mm[v]) mm[v] = mm[u],Q.push(v);
while (!Q.empty()) {
int u = Q.front();
Q.pop();
for (int v: adjList[u]) {
if ((v < K) && (mm[u] >= v)) return 1;
if (mm[u] > mm[v]) mm[v] = mm[u],Q.push(v);
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7312 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7312 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
3 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
3 ms |
7248 KB |
Output is correct |
11 |
Correct |
3 ms |
7248 KB |
Output is correct |
12 |
Correct |
3 ms |
7248 KB |
Output is correct |
13 |
Correct |
3 ms |
7248 KB |
Output is correct |
14 |
Correct |
3 ms |
7336 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
5 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7328 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7312 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
3 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
3 ms |
7248 KB |
Output is correct |
11 |
Correct |
3 ms |
7248 KB |
Output is correct |
12 |
Correct |
3 ms |
7248 KB |
Output is correct |
13 |
Correct |
3 ms |
7248 KB |
Output is correct |
14 |
Correct |
3 ms |
7336 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
5 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7328 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7364 KB |
Output is correct |
21 |
Correct |
5 ms |
7248 KB |
Output is correct |
22 |
Correct |
4 ms |
7360 KB |
Output is correct |
23 |
Correct |
4 ms |
7376 KB |
Output is correct |
24 |
Correct |
6 ms |
7376 KB |
Output is correct |
25 |
Correct |
6 ms |
7376 KB |
Output is correct |
26 |
Correct |
6 ms |
7376 KB |
Output is correct |
27 |
Correct |
6 ms |
7376 KB |
Output is correct |
28 |
Correct |
5 ms |
7376 KB |
Output is correct |
29 |
Correct |
6 ms |
7376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7312 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
3 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
3 ms |
7248 KB |
Output is correct |
11 |
Correct |
3 ms |
7248 KB |
Output is correct |
12 |
Correct |
3 ms |
7248 KB |
Output is correct |
13 |
Correct |
3 ms |
7248 KB |
Output is correct |
14 |
Correct |
3 ms |
7336 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
5 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7328 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7364 KB |
Output is correct |
21 |
Correct |
5 ms |
7248 KB |
Output is correct |
22 |
Correct |
4 ms |
7360 KB |
Output is correct |
23 |
Correct |
4 ms |
7376 KB |
Output is correct |
24 |
Correct |
6 ms |
7376 KB |
Output is correct |
25 |
Correct |
6 ms |
7376 KB |
Output is correct |
26 |
Correct |
6 ms |
7376 KB |
Output is correct |
27 |
Correct |
6 ms |
7376 KB |
Output is correct |
28 |
Correct |
5 ms |
7376 KB |
Output is correct |
29 |
Correct |
6 ms |
7376 KB |
Output is correct |
30 |
Correct |
20 ms |
7976 KB |
Output is correct |
31 |
Correct |
8 ms |
7632 KB |
Output is correct |
32 |
Correct |
20 ms |
8284 KB |
Output is correct |
33 |
Correct |
18 ms |
8360 KB |
Output is correct |
34 |
Correct |
541 ms |
8388 KB |
Output is correct |
35 |
Correct |
197 ms |
8408 KB |
Output is correct |
36 |
Correct |
38 ms |
8324 KB |
Output is correct |
37 |
Correct |
25 ms |
8356 KB |
Output is correct |
38 |
Correct |
26 ms |
8052 KB |
Output is correct |
39 |
Correct |
35 ms |
8072 KB |
Output is correct |
40 |
Correct |
454 ms |
8480 KB |
Output is correct |
41 |
Correct |
101 ms |
8272 KB |
Output is correct |
42 |
Correct |
77 ms |
8212 KB |
Output is correct |
43 |
Correct |
35 ms |
8432 KB |
Output is correct |
44 |
Correct |
285 ms |
8360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7248 KB |
Output is correct |
4 |
Correct |
3 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7312 KB |
Output is correct |
7 |
Correct |
4 ms |
7248 KB |
Output is correct |
8 |
Correct |
3 ms |
7248 KB |
Output is correct |
9 |
Correct |
4 ms |
7248 KB |
Output is correct |
10 |
Correct |
3 ms |
7248 KB |
Output is correct |
11 |
Correct |
3 ms |
7248 KB |
Output is correct |
12 |
Correct |
3 ms |
7248 KB |
Output is correct |
13 |
Correct |
3 ms |
7248 KB |
Output is correct |
14 |
Correct |
3 ms |
7336 KB |
Output is correct |
15 |
Correct |
4 ms |
7248 KB |
Output is correct |
16 |
Correct |
5 ms |
7248 KB |
Output is correct |
17 |
Correct |
4 ms |
7328 KB |
Output is correct |
18 |
Correct |
4 ms |
7248 KB |
Output is correct |
19 |
Correct |
4 ms |
7248 KB |
Output is correct |
20 |
Correct |
5 ms |
7364 KB |
Output is correct |
21 |
Correct |
5 ms |
7248 KB |
Output is correct |
22 |
Correct |
4 ms |
7360 KB |
Output is correct |
23 |
Correct |
4 ms |
7376 KB |
Output is correct |
24 |
Correct |
6 ms |
7376 KB |
Output is correct |
25 |
Correct |
6 ms |
7376 KB |
Output is correct |
26 |
Correct |
6 ms |
7376 KB |
Output is correct |
27 |
Correct |
6 ms |
7376 KB |
Output is correct |
28 |
Correct |
5 ms |
7376 KB |
Output is correct |
29 |
Correct |
6 ms |
7376 KB |
Output is correct |
30 |
Correct |
20 ms |
7976 KB |
Output is correct |
31 |
Correct |
8 ms |
7632 KB |
Output is correct |
32 |
Correct |
20 ms |
8284 KB |
Output is correct |
33 |
Correct |
18 ms |
8360 KB |
Output is correct |
34 |
Correct |
541 ms |
8388 KB |
Output is correct |
35 |
Correct |
197 ms |
8408 KB |
Output is correct |
36 |
Correct |
38 ms |
8324 KB |
Output is correct |
37 |
Correct |
25 ms |
8356 KB |
Output is correct |
38 |
Correct |
26 ms |
8052 KB |
Output is correct |
39 |
Correct |
35 ms |
8072 KB |
Output is correct |
40 |
Correct |
454 ms |
8480 KB |
Output is correct |
41 |
Correct |
101 ms |
8272 KB |
Output is correct |
42 |
Correct |
77 ms |
8212 KB |
Output is correct |
43 |
Correct |
35 ms |
8432 KB |
Output is correct |
44 |
Correct |
285 ms |
8360 KB |
Output is correct |
45 |
Correct |
176 ms |
14132 KB |
Output is correct |
46 |
Correct |
9 ms |
8656 KB |
Output is correct |
47 |
Correct |
9 ms |
8696 KB |
Output is correct |
48 |
Correct |
234 ms |
17948 KB |
Output is correct |
49 |
Correct |
186 ms |
17856 KB |
Output is correct |
50 |
Execution timed out |
4027 ms |
17888 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |