# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
957652 |
2024-04-04T07:02:52 Z |
pragmatist |
Game (APIO22_game) |
C++17 |
|
1 ms |
5208 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> g[30005];
bool is[1001][30005];
int n, k;
void init(int _n, int _k) {
n = _n;
k = _k;
for(int i = 1; i < k; ++i) {
g[i-1].push_back(i);
}
for(int i = 0; i < k; ++i) {
for(int j = i+1; j < k; ++j) {
is[i][j]=1;
}
}
}
bool ok;
void dfs(int v, int root) {
is[root][v] = 1;
for(auto to : g[v]) {
if(to == root) {
ok = 1;
}
if(!is[root][to]) {
dfs(to, root);
}
}
}
int add_teleporter(int u, int v) {
if(v<=u && u<k) {
return 1;
}
g[u].push_back(v);
ok = 0;
for(int i = 0; i < k; ++i) {
if(is[i][u]) {
dfs(u, i);
}
}
return ok;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
1 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
3208 KB |
Output is correct |
13 |
Incorrect |
1 ms |
3160 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
1 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
3208 KB |
Output is correct |
13 |
Incorrect |
1 ms |
3160 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
1 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
3208 KB |
Output is correct |
13 |
Incorrect |
1 ms |
3160 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1112 KB |
Output is correct |
2 |
Correct |
1 ms |
3160 KB |
Output is correct |
3 |
Correct |
1 ms |
5208 KB |
Output is correct |
4 |
Correct |
1 ms |
3160 KB |
Output is correct |
5 |
Correct |
1 ms |
5208 KB |
Output is correct |
6 |
Correct |
1 ms |
5208 KB |
Output is correct |
7 |
Correct |
1 ms |
5208 KB |
Output is correct |
8 |
Correct |
1 ms |
1112 KB |
Output is correct |
9 |
Correct |
1 ms |
1112 KB |
Output is correct |
10 |
Correct |
1 ms |
1112 KB |
Output is correct |
11 |
Correct |
1 ms |
3160 KB |
Output is correct |
12 |
Correct |
1 ms |
3208 KB |
Output is correct |
13 |
Incorrect |
1 ms |
3160 KB |
Wrong Answer[1] |
14 |
Halted |
0 ms |
0 KB |
- |