# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
752607 |
2023-06-03T09:48:20 Z |
Dan4Life |
Game (APIO22_game) |
C++17 |
|
5 ms |
9804 KB |
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int mxN = (int)2e5+10;
int n, k, sm[mxN], bg[mxN];
vector<int> adj[mxN], radj[mxN];
void init(int N, int K) {
n = N; k = K;
for(int i = 0; i < k; i++)
sm[i]=i, bg[i] = k-1;
for(int i = k; i < n; i++)
sm[i] = bg[i] = n+1;
}
void dfs(int s, int c){
if(sm[s]<=c) return;
sm[s] = min(sm[s], c); bg[s]=k-1;
for(auto u : radj[s]) dfs(u,c);
}
int add_teleporter(int u, int v) {
if(u>=v and u<k) return 1;
if(max(u,v)<k) return 0;
radj[v].pb(u); dfs(u, sm[v]);
return (sm[v]<=bg[u] and bg[u]<=k);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9804 KB |
Output is correct |
2 |
Correct |
5 ms |
9680 KB |
Output is correct |
3 |
Correct |
5 ms |
9680 KB |
Output is correct |
4 |
Correct |
5 ms |
9680 KB |
Output is correct |
5 |
Correct |
5 ms |
9680 KB |
Output is correct |
6 |
Correct |
5 ms |
9680 KB |
Output is correct |
7 |
Correct |
5 ms |
9680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9804 KB |
Output is correct |
2 |
Correct |
5 ms |
9680 KB |
Output is correct |
3 |
Correct |
5 ms |
9680 KB |
Output is correct |
4 |
Correct |
5 ms |
9680 KB |
Output is correct |
5 |
Correct |
5 ms |
9680 KB |
Output is correct |
6 |
Correct |
5 ms |
9680 KB |
Output is correct |
7 |
Correct |
5 ms |
9680 KB |
Output is correct |
8 |
Incorrect |
5 ms |
9680 KB |
Wrong Answer[1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9804 KB |
Output is correct |
2 |
Correct |
5 ms |
9680 KB |
Output is correct |
3 |
Correct |
5 ms |
9680 KB |
Output is correct |
4 |
Correct |
5 ms |
9680 KB |
Output is correct |
5 |
Correct |
5 ms |
9680 KB |
Output is correct |
6 |
Correct |
5 ms |
9680 KB |
Output is correct |
7 |
Correct |
5 ms |
9680 KB |
Output is correct |
8 |
Incorrect |
5 ms |
9680 KB |
Wrong Answer[1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9804 KB |
Output is correct |
2 |
Correct |
5 ms |
9680 KB |
Output is correct |
3 |
Correct |
5 ms |
9680 KB |
Output is correct |
4 |
Correct |
5 ms |
9680 KB |
Output is correct |
5 |
Correct |
5 ms |
9680 KB |
Output is correct |
6 |
Correct |
5 ms |
9680 KB |
Output is correct |
7 |
Correct |
5 ms |
9680 KB |
Output is correct |
8 |
Incorrect |
5 ms |
9680 KB |
Wrong Answer[1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
9804 KB |
Output is correct |
2 |
Correct |
5 ms |
9680 KB |
Output is correct |
3 |
Correct |
5 ms |
9680 KB |
Output is correct |
4 |
Correct |
5 ms |
9680 KB |
Output is correct |
5 |
Correct |
5 ms |
9680 KB |
Output is correct |
6 |
Correct |
5 ms |
9680 KB |
Output is correct |
7 |
Correct |
5 ms |
9680 KB |
Output is correct |
8 |
Incorrect |
5 ms |
9680 KB |
Wrong Answer[1] |
9 |
Halted |
0 ms |
0 KB |
- |