# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
816396 |
2023-08-09T04:59:34 Z |
이동현(#10127) |
Game (APIO22_game) |
C++17 |
|
3 ms |
3408 KB |
#include "game.h"
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
int n, k;
bool chk[30004];
vector<int> way[30004], wayb[30004];
int que[30004], f, r;
int chkn;
void init(int N, int K) {
n = N, k = K;
assert(n <= 30000 && k <= 1000);
}
int add_teleporter(int u, int v) {
way[u].push_back(v);
wayb[v].push_back(u);
int mn = (int)1e9, mx = -1;
f = r = 0;
++chkn;
que[r++] = v, chk[v] = chkn;
while(f < r){
int now = que[f++];
if(now < k) mn = min(mn, now);
for(auto&nxt:way[now]){
if(chkn != chk[nxt]){
chk[nxt] = chkn;
que[r++] = nxt;
}
}
}
++chkn;
f = r = 0;
que[r++] = u, chk[u] = chkn;
while(f < r){
int now = que[f++];
if(now < k) mx = max(mx, now);
for(auto&nxt:wayb[now]){
if(chkn != chk[nxt]){
chk[nxt] = chkn;
que[r++] = nxt;
}
}
}
return mn <= mx;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3408 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3408 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3408 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3408 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
3408 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |