# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
982699 |
2024-05-14T16:14:20 Z |
vjudge1 |
Game (APIO22_game) |
C++17 |
|
2 ms |
7512 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector <ll>;
const ll MAXN = 3E5+16;
int n, k;
vll adj[MAXN];
void init (int n, int k) {
::n = n, ::k = k;
for (ll i = 1; i < k; i++) {
adj[i-1].push_back(i);
}
}
ll tvis[MAXN];
ll timer = 1;
ll dfs (ll u, ll par, ll lastK) {
if (tvis[u] == timer) return 0;
tvis[u] = timer;
for (ll v : adj[u]) {
if (v <= lastK) return 1;
if (dfs(v, u, (u < k ? u : lastK))) return 1;
}
return 0;
}
int add_teleporter (int u, int v) {
adj[u].push_back(v);
timer++;
return dfs(0, 0, 0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Incorrect |
2 ms |
7512 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Incorrect |
2 ms |
7512 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Incorrect |
2 ms |
7512 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Incorrect |
2 ms |
7512 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
7512 KB |
Output is correct |
2 |
Incorrect |
2 ms |
7512 KB |
Wrong Answer[1] |
3 |
Halted |
0 ms |
0 KB |
- |