#include "game.h"
#ifdef NYAOWO
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;
const int MAXN = 300030;
int n, k;
vector<int> adj[MAXN];
int vis[MAXN];
void init(int _n, int _k) {
n = _n; k = _k;
For(i, 0, n - 1) {
adj[i].clear();
}
}
int dfs(int x, int t) {
if(vis[x] != -1) return vis[x];
vis[x] = 0;
for(auto &i:adj[x]) {
if(i <= t) return vis[x] = 1;
if(dfs(i, t)) return vis[x] = 1;
}
return vis[x];
}
int add_teleporter(int u, int v) {
if(u < k && v < k && u < v) return 0;
memset(vis, -1, sizeof(vis));
adj[u].eb(v);
int ok = 0;
For(i, 0, k - 1) ok = max(ok, dfs(i, i));
return ok;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
8400 KB |
Output is correct |
2 |
Correct |
6 ms |
8528 KB |
Output is correct |
3 |
Correct |
4 ms |
8400 KB |
Output is correct |
4 |
Correct |
4 ms |
8504 KB |
Output is correct |
5 |
Correct |
4 ms |
8400 KB |
Output is correct |
6 |
Correct |
4 ms |
8400 KB |
Output is correct |
7 |
Correct |
4 ms |
8400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
8400 KB |
Output is correct |
2 |
Correct |
6 ms |
8528 KB |
Output is correct |
3 |
Correct |
4 ms |
8400 KB |
Output is correct |
4 |
Correct |
4 ms |
8504 KB |
Output is correct |
5 |
Correct |
4 ms |
8400 KB |
Output is correct |
6 |
Correct |
4 ms |
8400 KB |
Output is correct |
7 |
Correct |
4 ms |
8400 KB |
Output is correct |
8 |
Correct |
5 ms |
8400 KB |
Output is correct |
9 |
Correct |
4 ms |
8512 KB |
Output is correct |
10 |
Correct |
4 ms |
8400 KB |
Output is correct |
11 |
Correct |
9 ms |
8512 KB |
Output is correct |
12 |
Correct |
7 ms |
8400 KB |
Output is correct |
13 |
Correct |
7 ms |
8400 KB |
Output is correct |
14 |
Incorrect |
7 ms |
8516 KB |
Wrong Answer[1] |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
8400 KB |
Output is correct |
2 |
Correct |
6 ms |
8528 KB |
Output is correct |
3 |
Correct |
4 ms |
8400 KB |
Output is correct |
4 |
Correct |
4 ms |
8504 KB |
Output is correct |
5 |
Correct |
4 ms |
8400 KB |
Output is correct |
6 |
Correct |
4 ms |
8400 KB |
Output is correct |
7 |
Correct |
4 ms |
8400 KB |
Output is correct |
8 |
Correct |
5 ms |
8400 KB |
Output is correct |
9 |
Correct |
4 ms |
8512 KB |
Output is correct |
10 |
Correct |
4 ms |
8400 KB |
Output is correct |
11 |
Correct |
9 ms |
8512 KB |
Output is correct |
12 |
Correct |
7 ms |
8400 KB |
Output is correct |
13 |
Correct |
7 ms |
8400 KB |
Output is correct |
14 |
Incorrect |
7 ms |
8516 KB |
Wrong Answer[1] |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
8400 KB |
Output is correct |
2 |
Correct |
6 ms |
8528 KB |
Output is correct |
3 |
Correct |
4 ms |
8400 KB |
Output is correct |
4 |
Correct |
4 ms |
8504 KB |
Output is correct |
5 |
Correct |
4 ms |
8400 KB |
Output is correct |
6 |
Correct |
4 ms |
8400 KB |
Output is correct |
7 |
Correct |
4 ms |
8400 KB |
Output is correct |
8 |
Correct |
5 ms |
8400 KB |
Output is correct |
9 |
Correct |
4 ms |
8512 KB |
Output is correct |
10 |
Correct |
4 ms |
8400 KB |
Output is correct |
11 |
Correct |
9 ms |
8512 KB |
Output is correct |
12 |
Correct |
7 ms |
8400 KB |
Output is correct |
13 |
Correct |
7 ms |
8400 KB |
Output is correct |
14 |
Incorrect |
7 ms |
8516 KB |
Wrong Answer[1] |
15 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
8400 KB |
Output is correct |
2 |
Correct |
6 ms |
8528 KB |
Output is correct |
3 |
Correct |
4 ms |
8400 KB |
Output is correct |
4 |
Correct |
4 ms |
8504 KB |
Output is correct |
5 |
Correct |
4 ms |
8400 KB |
Output is correct |
6 |
Correct |
4 ms |
8400 KB |
Output is correct |
7 |
Correct |
4 ms |
8400 KB |
Output is correct |
8 |
Correct |
5 ms |
8400 KB |
Output is correct |
9 |
Correct |
4 ms |
8512 KB |
Output is correct |
10 |
Correct |
4 ms |
8400 KB |
Output is correct |
11 |
Correct |
9 ms |
8512 KB |
Output is correct |
12 |
Correct |
7 ms |
8400 KB |
Output is correct |
13 |
Correct |
7 ms |
8400 KB |
Output is correct |
14 |
Incorrect |
7 ms |
8516 KB |
Wrong Answer[1] |
15 |
Halted |
0 ms |
0 KB |
- |