Submission #1009893

# Submission time Handle Problem Language Result Execution time Memory
1009893 2024-06-28T07:21:09 Z pcc Game (APIO22_game) C++17
60 / 100
1317 ms 39104 KB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
 
const int mxk = 1010;
const int mxn = 3e4+10;
 
bool flag = false;
char cnt[mxk][mxn];
 
void add(int row,int k){
	cnt[row][k]++;
	if(cnt[row][k]>=2)flag = true;
	return;
}
 
const int LEN = 1e5+10;
struct GRAPH{
	int nid[LEN],head[LEN],to[LEN],ptr;
	GRAPH(){
		memset(head,0,sizeof(head));
		ptr = 0;
	}
	void add_edge(int a,int b){
		assert(ptr<LEN);
		ptr++;
		nid[ptr] = head[a];
		head[a] = ptr;
		to[ptr] = b;
		return;
	}
};
 
GRAPH g,rg;
 
 
struct DS{
	bitset<mxn> vis,rvis;
	int id;
	DS(int ii = 0):id(ii){vis.reset();rvis.reset();}
	void DFS(int now){
		if(vis[now])return;
		vis[now] = 1;
		add(id,now);
		for(int eid = g.head[now];eid;eid = g.nid[eid]){
			int nxt = g.to[eid];
			if(vis[nxt])continue;
			DFS(nxt);
		}
		return;
	}
	void RDFS(int now){
		if(rvis[now])return;
		rvis[now] = 1;
		add(id,now);
		for(int eid = rg.head[now];eid;eid = rg.nid[eid]){
			int nxt = rg.to[eid];
			if(rvis[nxt])continue;
			RDFS(nxt);
		}
	}
	void add_edge(int a,int b){
		if(vis[a])DFS(b);
		if(rvis[b])RDFS(a);
		return;
	}
};
 
DS arr[mxk];
int N,K;
 
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.add_edge(i,i+1);
		rg.add_edge(i+1,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.add_edge(u,v);
		rg.add_edge(v,u);
	for(int i = 0;i<K;i++){
		arr[i].add_edge(u,v);
	}
	return flag;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8536 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 3 ms 9048 KB Output is correct
4 Correct 3 ms 8620 KB Output is correct
5 Correct 4 ms 9048 KB Output is correct
6 Correct 3 ms 9048 KB Output is correct
7 Correct 3 ms 9048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8536 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 3 ms 9048 KB Output is correct
4 Correct 3 ms 8620 KB Output is correct
5 Correct 4 ms 9048 KB Output is correct
6 Correct 3 ms 9048 KB Output is correct
7 Correct 3 ms 9048 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8536 KB Output is correct
10 Correct 4 ms 8536 KB Output is correct
11 Correct 4 ms 8536 KB Output is correct
12 Correct 3 ms 8576 KB Output is correct
13 Correct 3 ms 8536 KB Output is correct
14 Correct 3 ms 8792 KB Output is correct
15 Correct 3 ms 8536 KB Output is correct
16 Correct 3 ms 8536 KB Output is correct
17 Correct 3 ms 8792 KB Output is correct
18 Correct 3 ms 8840 KB Output is correct
19 Correct 3 ms 8792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8536 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 3 ms 9048 KB Output is correct
4 Correct 3 ms 8620 KB Output is correct
5 Correct 4 ms 9048 KB Output is correct
6 Correct 3 ms 9048 KB Output is correct
7 Correct 3 ms 9048 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8536 KB Output is correct
10 Correct 4 ms 8536 KB Output is correct
11 Correct 4 ms 8536 KB Output is correct
12 Correct 3 ms 8576 KB Output is correct
13 Correct 3 ms 8536 KB Output is correct
14 Correct 3 ms 8792 KB Output is correct
15 Correct 3 ms 8536 KB Output is correct
16 Correct 3 ms 8536 KB Output is correct
17 Correct 3 ms 8792 KB Output is correct
18 Correct 3 ms 8840 KB Output is correct
19 Correct 3 ms 8792 KB Output is correct
20 Correct 3 ms 8536 KB Output is correct
21 Correct 4 ms 9048 KB Output is correct
22 Correct 4 ms 9048 KB Output is correct
23 Correct 3 ms 8536 KB Output is correct
24 Correct 8 ms 11040 KB Output is correct
25 Correct 7 ms 9952 KB Output is correct
26 Correct 6 ms 9212 KB Output is correct
27 Correct 13 ms 11096 KB Output is correct
28 Correct 9 ms 10976 KB Output is correct
29 Correct 12 ms 11096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8536 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 3 ms 9048 KB Output is correct
4 Correct 3 ms 8620 KB Output is correct
5 Correct 4 ms 9048 KB Output is correct
6 Correct 3 ms 9048 KB Output is correct
7 Correct 3 ms 9048 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8536 KB Output is correct
10 Correct 4 ms 8536 KB Output is correct
11 Correct 4 ms 8536 KB Output is correct
12 Correct 3 ms 8576 KB Output is correct
13 Correct 3 ms 8536 KB Output is correct
14 Correct 3 ms 8792 KB Output is correct
15 Correct 3 ms 8536 KB Output is correct
16 Correct 3 ms 8536 KB Output is correct
17 Correct 3 ms 8792 KB Output is correct
18 Correct 3 ms 8840 KB Output is correct
19 Correct 3 ms 8792 KB Output is correct
20 Correct 3 ms 8536 KB Output is correct
21 Correct 4 ms 9048 KB Output is correct
22 Correct 4 ms 9048 KB Output is correct
23 Correct 3 ms 8536 KB Output is correct
24 Correct 8 ms 11040 KB Output is correct
25 Correct 7 ms 9952 KB Output is correct
26 Correct 6 ms 9212 KB Output is correct
27 Correct 13 ms 11096 KB Output is correct
28 Correct 9 ms 10976 KB Output is correct
29 Correct 12 ms 11096 KB Output is correct
30 Correct 17 ms 11864 KB Output is correct
31 Correct 62 ms 37976 KB Output is correct
32 Correct 44 ms 12228 KB Output is correct
33 Correct 11 ms 9304 KB Output is correct
34 Correct 507 ms 38736 KB Output is correct
35 Correct 720 ms 38808 KB Output is correct
36 Correct 61 ms 12120 KB Output is correct
37 Correct 1020 ms 38752 KB Output is correct
38 Correct 722 ms 38732 KB Output is correct
39 Correct 742 ms 38500 KB Output is correct
40 Correct 586 ms 39104 KB Output is correct
41 Correct 617 ms 38848 KB Output is correct
42 Correct 513 ms 38640 KB Output is correct
43 Correct 1317 ms 38828 KB Output is correct
44 Correct 978 ms 38612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 8536 KB Output is correct
2 Correct 3 ms 8536 KB Output is correct
3 Correct 3 ms 9048 KB Output is correct
4 Correct 3 ms 8620 KB Output is correct
5 Correct 4 ms 9048 KB Output is correct
6 Correct 3 ms 9048 KB Output is correct
7 Correct 3 ms 9048 KB Output is correct
8 Correct 3 ms 8536 KB Output is correct
9 Correct 3 ms 8536 KB Output is correct
10 Correct 4 ms 8536 KB Output is correct
11 Correct 4 ms 8536 KB Output is correct
12 Correct 3 ms 8576 KB Output is correct
13 Correct 3 ms 8536 KB Output is correct
14 Correct 3 ms 8792 KB Output is correct
15 Correct 3 ms 8536 KB Output is correct
16 Correct 3 ms 8536 KB Output is correct
17 Correct 3 ms 8792 KB Output is correct
18 Correct 3 ms 8840 KB Output is correct
19 Correct 3 ms 8792 KB Output is correct
20 Correct 3 ms 8536 KB Output is correct
21 Correct 4 ms 9048 KB Output is correct
22 Correct 4 ms 9048 KB Output is correct
23 Correct 3 ms 8536 KB Output is correct
24 Correct 8 ms 11040 KB Output is correct
25 Correct 7 ms 9952 KB Output is correct
26 Correct 6 ms 9212 KB Output is correct
27 Correct 13 ms 11096 KB Output is correct
28 Correct 9 ms 10976 KB Output is correct
29 Correct 12 ms 11096 KB Output is correct
30 Correct 17 ms 11864 KB Output is correct
31 Correct 62 ms 37976 KB Output is correct
32 Correct 44 ms 12228 KB Output is correct
33 Correct 11 ms 9304 KB Output is correct
34 Correct 507 ms 38736 KB Output is correct
35 Correct 720 ms 38808 KB Output is correct
36 Correct 61 ms 12120 KB Output is correct
37 Correct 1020 ms 38752 KB Output is correct
38 Correct 722 ms 38732 KB Output is correct
39 Correct 742 ms 38500 KB Output is correct
40 Correct 586 ms 39104 KB Output is correct
41 Correct 617 ms 38848 KB Output is correct
42 Correct 513 ms 38640 KB Output is correct
43 Correct 1317 ms 38828 KB Output is correct
44 Correct 978 ms 38612 KB Output is correct
45 Incorrect 7 ms 12116 KB Wrong Answer[1]
46 Halted 0 ms 0 KB -