# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1009892 |
2024-06-28T07:20:00 Z |
pcc |
게임 (APIO22_game) |
C++17 |
|
1665 ms |
41432 KB |
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")
const int mxk = 1010;
const int mxn = 3e4+10;
bool flag = false;
char cnt[mxk*mxn];
int N,K;
void add(int k){
cnt[k]++;
if(cnt[k]>=2)flag = true;
return;
}
vector<short> g[mxn],rg[mxn];
struct DS{
bitset<mxn> vis,rvis;
int id;
DS(int ii = 0):id(ii){vis.reset();rvis.reset();}
queue<short> q;
void BFS(int now){
if(vis[now])return;
q.push(now);
vis[now] = true;add(id*N+now);
while(!q.empty()){
auto now = q.front();
q.pop();
for(auto nxt:g[now]){
if(vis[nxt])continue;
vis[nxt] = true;add(id*N+nxt);
q.push(nxt);
}
}
return;
}
void RBFS(int now){
if(rvis[now])return;
q.push(now);
rvis[now] = true;add(id*N+now);
while(!q.empty()){
auto now = q.front();
q.pop();
for(auto nxt:rg[now]){
if(rvis[nxt])continue;
rvis[nxt] = true;add(id*N+nxt);
q.push(nxt);
}
}
return;
}
void add_edge(int a,int b){
if(vis[a])BFS(b);
if(rvis[b])RBFS(a);
return;
}
};
DS arr[mxk];
void init(int n, int k) {
N = n,K = k;
for(int i = 0;i<k;i++){
arr[i].id = i;
arr[i].vis[i] = arr[i].rvis[i] = 1;
}
for(int i = 0;i<=k-2;i++){
g[i].push_back(i+1);
rg[i+1].push_back(i);
for(int j = 0;j<k;j++){
arr[j].add_edge(i,i+1);
}
}
flag = false;
/*
cerr<<"INIT DONE!"<<endl;
for(int i = 0;i<K;i++){
for(int j = 0;j<N;j++)cerr<<arr[i].vis[j];cerr<<endl;
for(int j = 0;j<N;j++)cerr<<arr[i].rvis[j];cerr<<endl;
cerr<<endl;
}
*/
return;
}
int add_teleporter(int u, int v) {
if(u == v){
return (u<K);
}
g[u].push_back(v);
rg[v].push_back(u);
for(int i = 0;i<K;i++){
arr[i].add_edge(u,v);
}
return flag;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
4 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
4 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
4 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
4 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
8 |
Correct |
4 ms |
9816 KB |
Output is correct |
9 |
Correct |
4 ms |
9816 KB |
Output is correct |
10 |
Correct |
4 ms |
9816 KB |
Output is correct |
11 |
Correct |
4 ms |
9816 KB |
Output is correct |
12 |
Correct |
4 ms |
9816 KB |
Output is correct |
13 |
Correct |
4 ms |
9816 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
4 ms |
9816 KB |
Output is correct |
16 |
Correct |
4 ms |
9816 KB |
Output is correct |
17 |
Correct |
4 ms |
9820 KB |
Output is correct |
18 |
Correct |
4 ms |
9816 KB |
Output is correct |
19 |
Correct |
4 ms |
9820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
4 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
4 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
8 |
Correct |
4 ms |
9816 KB |
Output is correct |
9 |
Correct |
4 ms |
9816 KB |
Output is correct |
10 |
Correct |
4 ms |
9816 KB |
Output is correct |
11 |
Correct |
4 ms |
9816 KB |
Output is correct |
12 |
Correct |
4 ms |
9816 KB |
Output is correct |
13 |
Correct |
4 ms |
9816 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
4 ms |
9816 KB |
Output is correct |
16 |
Correct |
4 ms |
9816 KB |
Output is correct |
17 |
Correct |
4 ms |
9820 KB |
Output is correct |
18 |
Correct |
4 ms |
9816 KB |
Output is correct |
19 |
Correct |
4 ms |
9820 KB |
Output is correct |
20 |
Correct |
4 ms |
9816 KB |
Output is correct |
21 |
Correct |
4 ms |
9816 KB |
Output is correct |
22 |
Correct |
5 ms |
10076 KB |
Output is correct |
23 |
Correct |
4 ms |
10008 KB |
Output is correct |
24 |
Correct |
10 ms |
10328 KB |
Output is correct |
25 |
Correct |
10 ms |
10072 KB |
Output is correct |
26 |
Correct |
7 ms |
10072 KB |
Output is correct |
27 |
Correct |
19 ms |
10584 KB |
Output is correct |
28 |
Correct |
11 ms |
10328 KB |
Output is correct |
29 |
Correct |
13 ms |
10328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
4 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
4 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
8 |
Correct |
4 ms |
9816 KB |
Output is correct |
9 |
Correct |
4 ms |
9816 KB |
Output is correct |
10 |
Correct |
4 ms |
9816 KB |
Output is correct |
11 |
Correct |
4 ms |
9816 KB |
Output is correct |
12 |
Correct |
4 ms |
9816 KB |
Output is correct |
13 |
Correct |
4 ms |
9816 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
4 ms |
9816 KB |
Output is correct |
16 |
Correct |
4 ms |
9816 KB |
Output is correct |
17 |
Correct |
4 ms |
9820 KB |
Output is correct |
18 |
Correct |
4 ms |
9816 KB |
Output is correct |
19 |
Correct |
4 ms |
9820 KB |
Output is correct |
20 |
Correct |
4 ms |
9816 KB |
Output is correct |
21 |
Correct |
4 ms |
9816 KB |
Output is correct |
22 |
Correct |
5 ms |
10076 KB |
Output is correct |
23 |
Correct |
4 ms |
10008 KB |
Output is correct |
24 |
Correct |
10 ms |
10328 KB |
Output is correct |
25 |
Correct |
10 ms |
10072 KB |
Output is correct |
26 |
Correct |
7 ms |
10072 KB |
Output is correct |
27 |
Correct |
19 ms |
10584 KB |
Output is correct |
28 |
Correct |
11 ms |
10328 KB |
Output is correct |
29 |
Correct |
13 ms |
10328 KB |
Output is correct |
30 |
Correct |
25 ms |
13796 KB |
Output is correct |
31 |
Correct |
74 ms |
39504 KB |
Output is correct |
32 |
Correct |
94 ms |
14720 KB |
Output is correct |
33 |
Correct |
15 ms |
12120 KB |
Output is correct |
34 |
Correct |
1218 ms |
40992 KB |
Output is correct |
35 |
Correct |
1060 ms |
41188 KB |
Output is correct |
36 |
Correct |
70 ms |
14672 KB |
Output is correct |
37 |
Correct |
1109 ms |
41316 KB |
Output is correct |
38 |
Correct |
830 ms |
40944 KB |
Output is correct |
39 |
Correct |
848 ms |
40876 KB |
Output is correct |
40 |
Correct |
1207 ms |
41216 KB |
Output is correct |
41 |
Correct |
881 ms |
41096 KB |
Output is correct |
42 |
Correct |
777 ms |
40916 KB |
Output is correct |
43 |
Correct |
1665 ms |
41432 KB |
Output is correct |
44 |
Correct |
670 ms |
41040 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
9816 KB |
Output is correct |
2 |
Correct |
4 ms |
9816 KB |
Output is correct |
3 |
Correct |
4 ms |
9816 KB |
Output is correct |
4 |
Correct |
4 ms |
9816 KB |
Output is correct |
5 |
Correct |
4 ms |
9816 KB |
Output is correct |
6 |
Correct |
4 ms |
9816 KB |
Output is correct |
7 |
Correct |
4 ms |
9816 KB |
Output is correct |
8 |
Correct |
4 ms |
9816 KB |
Output is correct |
9 |
Correct |
4 ms |
9816 KB |
Output is correct |
10 |
Correct |
4 ms |
9816 KB |
Output is correct |
11 |
Correct |
4 ms |
9816 KB |
Output is correct |
12 |
Correct |
4 ms |
9816 KB |
Output is correct |
13 |
Correct |
4 ms |
9816 KB |
Output is correct |
14 |
Correct |
4 ms |
9816 KB |
Output is correct |
15 |
Correct |
4 ms |
9816 KB |
Output is correct |
16 |
Correct |
4 ms |
9816 KB |
Output is correct |
17 |
Correct |
4 ms |
9820 KB |
Output is correct |
18 |
Correct |
4 ms |
9816 KB |
Output is correct |
19 |
Correct |
4 ms |
9820 KB |
Output is correct |
20 |
Correct |
4 ms |
9816 KB |
Output is correct |
21 |
Correct |
4 ms |
9816 KB |
Output is correct |
22 |
Correct |
5 ms |
10076 KB |
Output is correct |
23 |
Correct |
4 ms |
10008 KB |
Output is correct |
24 |
Correct |
10 ms |
10328 KB |
Output is correct |
25 |
Correct |
10 ms |
10072 KB |
Output is correct |
26 |
Correct |
7 ms |
10072 KB |
Output is correct |
27 |
Correct |
19 ms |
10584 KB |
Output is correct |
28 |
Correct |
11 ms |
10328 KB |
Output is correct |
29 |
Correct |
13 ms |
10328 KB |
Output is correct |
30 |
Correct |
25 ms |
13796 KB |
Output is correct |
31 |
Correct |
74 ms |
39504 KB |
Output is correct |
32 |
Correct |
94 ms |
14720 KB |
Output is correct |
33 |
Correct |
15 ms |
12120 KB |
Output is correct |
34 |
Correct |
1218 ms |
40992 KB |
Output is correct |
35 |
Correct |
1060 ms |
41188 KB |
Output is correct |
36 |
Correct |
70 ms |
14672 KB |
Output is correct |
37 |
Correct |
1109 ms |
41316 KB |
Output is correct |
38 |
Correct |
830 ms |
40944 KB |
Output is correct |
39 |
Correct |
848 ms |
40876 KB |
Output is correct |
40 |
Correct |
1207 ms |
41216 KB |
Output is correct |
41 |
Correct |
881 ms |
41096 KB |
Output is correct |
42 |
Correct |
777 ms |
40916 KB |
Output is correct |
43 |
Correct |
1665 ms |
41432 KB |
Output is correct |
44 |
Correct |
670 ms |
41040 KB |
Output is correct |
45 |
Runtime error |
23 ms |
23896 KB |
Execution killed with signal 6 |
46 |
Halted |
0 ms |
0 KB |
- |