# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
985277 |
2024-05-17T14:20:38 Z |
ph0enlx |
Game (APIO22_game) |
C++17 |
|
6 ms |
14560 KB |
#include<bits/stdc++.h>
using namespace std;
const int N = 3e5+10;
vector<set<int>> g(N);
int ng, kg;
void dfs(int ver, int par, bool &exist, vector<bool> &vis, int ret)
{
vis[ver] = true;
for(int child : g[ver])
{
if(vis[child])
{
if(child==ret)
{
exist = true;
return;
}
continue;
}
dfs(child, ver, exist, vis, ret);
}
}
void init(int n, int k)
{
ng = n, kg = k;
for(int i=0; i<k-1; i++)
{
g[i].insert(i+1);
}
}
int add_teleporter(int u, int v)
{
if(u==v) return 1;
g[u].insert(v);
vector<bool> vis(ng);
bool exist=false;
for(int i=0; i<kg; i++)
{
if(vis[i]) continue;
dfs(i, i, exist, vis, i);
if(exist) return 1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
14424 KB |
Output is correct |
2 |
Correct |
4 ms |
14424 KB |
Output is correct |
3 |
Correct |
6 ms |
14560 KB |
Output is correct |
4 |
Incorrect |
4 ms |
14424 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
14424 KB |
Output is correct |
2 |
Correct |
4 ms |
14424 KB |
Output is correct |
3 |
Correct |
6 ms |
14560 KB |
Output is correct |
4 |
Incorrect |
4 ms |
14424 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
14424 KB |
Output is correct |
2 |
Correct |
4 ms |
14424 KB |
Output is correct |
3 |
Correct |
6 ms |
14560 KB |
Output is correct |
4 |
Incorrect |
4 ms |
14424 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
14424 KB |
Output is correct |
2 |
Correct |
4 ms |
14424 KB |
Output is correct |
3 |
Correct |
6 ms |
14560 KB |
Output is correct |
4 |
Incorrect |
4 ms |
14424 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
14424 KB |
Output is correct |
2 |
Correct |
4 ms |
14424 KB |
Output is correct |
3 |
Correct |
6 ms |
14560 KB |
Output is correct |
4 |
Incorrect |
4 ms |
14424 KB |
Wrong Answer[1] |
5 |
Halted |
0 ms |
0 KB |
- |