# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
746849 |
2023-05-23T07:13:55 Z |
tutis |
Game (APIO22_game) |
C++17 |
|
5 ms |
7352 KB |
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
const int N = 300000;
int K;
vector<int>adj_[N];
int mn[N];
void init(int n, int k) {
K = k;
for (int i = 0; i < n; i++)
mn[i] = k;
}
int add_teleporter(int u, int v) {
int x = min(v, mn[v]);
int ret = 0;
function<void(int)>dfs = [&](int i) {
mn[i] = x;
if (x <= i) {
ret = 1;
}
for (int j : adj_[i])
if (mn[j] > x)
dfs(j);
};
if (mn[u] > x)
dfs(u);
adj_[v].push_back(u);
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7352 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
5 ms |
7248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7352 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
5 ms |
7248 KB |
Output is correct |
8 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7352 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
5 ms |
7248 KB |
Output is correct |
8 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7352 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
5 ms |
7248 KB |
Output is correct |
8 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7248 KB |
Output is correct |
2 |
Correct |
4 ms |
7248 KB |
Output is correct |
3 |
Correct |
4 ms |
7352 KB |
Output is correct |
4 |
Correct |
4 ms |
7248 KB |
Output is correct |
5 |
Correct |
4 ms |
7248 KB |
Output is correct |
6 |
Correct |
4 ms |
7248 KB |
Output is correct |
7 |
Correct |
5 ms |
7248 KB |
Output is correct |
8 |
Incorrect |
4 ms |
7248 KB |
Wrong Answer[1] |
9 |
Halted |
0 ms |
0 KB |
- |