Submission #965123

# Submission time Handle Problem Language Result Execution time Memory
965123 2024-04-18T07:20:26 Z pcc Cell Automaton (JOI23_cell) C++17
4 / 100
17 ms 912 KB
#include <bits/stdc++.h>
using namespace std;

#define pii pair<int,int>
#define fs first
#define sc second

const int mxn = 220;
const int sh = mxn>>1;
int arr[mxn][mxn],brr[mxn][mxn];
int N,Q;
int req[mxn];
pii dir[] = {{-1,0},{1,0},{0,1},{0,-1}};

void move(){
	memset(brr,0,sizeof(brr));
	for(int i = 0;i<mxn;i++){
		for(int j = 0;j<mxn;j++){
			if(arr[i][j] == 2)brr[i][j] = 0;
			else if(arr[i][j] == 1){
				brr[i][j] = 2;
				for(auto &d:dir){
					if(arr[i+d.fs][j+d.sc] != 2&&arr[i+d.fs][j+d.sc] != 1)brr[i+d.fs][j+d.sc] = 1;
				}
			}
		}
	}
	for(int i = 0;i<mxn;i++){
		for(int j = 0;j<mxn;j++)arr[i][j] = brr[i][j];
	}
	/*
	for(auto &i:arr){
		for(auto &j:i)cout<<j;cout<<endl;
	}cout<<endl;

   */
	return;
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N>>Q;
	for(int i = 0;i<N;i++){
		int r,c;
		cin>>r>>c;
		arr[r+sh][c+sh] = 1;
	}
	int t = 0;
	while(Q--){
		int k;
		cin>>k;
		while(t<k){
			t++;
			move();
		}
		int ans = 0;
		for(auto &i:arr){
			for(auto &j:i)ans += (j == 1);
		}
		cout<<ans<<'\n';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 5 ms 720 KB Output is correct
3 Correct 6 ms 600 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
5 Correct 5 ms 604 KB Output is correct
6 Correct 5 ms 724 KB Output is correct
7 Correct 5 ms 604 KB Output is correct
8 Correct 6 ms 912 KB Output is correct
9 Correct 5 ms 604 KB Output is correct
10 Correct 5 ms 600 KB Output is correct
11 Correct 5 ms 600 KB Output is correct
12 Correct 6 ms 604 KB Output is correct
13 Correct 6 ms 852 KB Output is correct
14 Correct 6 ms 604 KB Output is correct
15 Correct 5 ms 848 KB Output is correct
16 Correct 6 ms 604 KB Output is correct
17 Correct 5 ms 604 KB Output is correct
18 Correct 5 ms 604 KB Output is correct
19 Correct 5 ms 604 KB Output is correct
20 Correct 5 ms 840 KB Output is correct
21 Correct 5 ms 600 KB Output is correct
22 Correct 5 ms 752 KB Output is correct
23 Correct 5 ms 604 KB Output is correct
24 Correct 5 ms 604 KB Output is correct
25 Correct 5 ms 608 KB Output is correct
26 Correct 5 ms 600 KB Output is correct
27 Correct 7 ms 604 KB Output is correct
28 Correct 5 ms 840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 5 ms 720 KB Output is correct
3 Correct 6 ms 600 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
5 Correct 5 ms 604 KB Output is correct
6 Correct 5 ms 724 KB Output is correct
7 Correct 5 ms 604 KB Output is correct
8 Correct 6 ms 912 KB Output is correct
9 Correct 5 ms 604 KB Output is correct
10 Correct 5 ms 600 KB Output is correct
11 Correct 5 ms 600 KB Output is correct
12 Correct 6 ms 604 KB Output is correct
13 Correct 6 ms 852 KB Output is correct
14 Correct 6 ms 604 KB Output is correct
15 Correct 5 ms 848 KB Output is correct
16 Correct 6 ms 604 KB Output is correct
17 Correct 5 ms 604 KB Output is correct
18 Correct 5 ms 604 KB Output is correct
19 Correct 5 ms 604 KB Output is correct
20 Correct 5 ms 840 KB Output is correct
21 Correct 5 ms 600 KB Output is correct
22 Correct 5 ms 752 KB Output is correct
23 Correct 5 ms 604 KB Output is correct
24 Correct 5 ms 604 KB Output is correct
25 Correct 5 ms 608 KB Output is correct
26 Correct 5 ms 600 KB Output is correct
27 Correct 7 ms 604 KB Output is correct
28 Correct 5 ms 840 KB Output is correct
29 Incorrect 17 ms 844 KB Output isn't correct
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 604 KB Output is correct
2 Correct 5 ms 720 KB Output is correct
3 Correct 6 ms 600 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
5 Correct 5 ms 604 KB Output is correct
6 Correct 5 ms 724 KB Output is correct
7 Correct 5 ms 604 KB Output is correct
8 Correct 6 ms 912 KB Output is correct
9 Correct 5 ms 604 KB Output is correct
10 Correct 5 ms 600 KB Output is correct
11 Correct 5 ms 600 KB Output is correct
12 Correct 6 ms 604 KB Output is correct
13 Correct 6 ms 852 KB Output is correct
14 Correct 6 ms 604 KB Output is correct
15 Correct 5 ms 848 KB Output is correct
16 Correct 6 ms 604 KB Output is correct
17 Correct 5 ms 604 KB Output is correct
18 Correct 5 ms 604 KB Output is correct
19 Correct 5 ms 604 KB Output is correct
20 Correct 5 ms 840 KB Output is correct
21 Correct 5 ms 600 KB Output is correct
22 Correct 5 ms 752 KB Output is correct
23 Correct 5 ms 604 KB Output is correct
24 Correct 5 ms 604 KB Output is correct
25 Correct 5 ms 608 KB Output is correct
26 Correct 5 ms 600 KB Output is correct
27 Correct 7 ms 604 KB Output is correct
28 Correct 5 ms 840 KB Output is correct
29 Incorrect 17 ms 844 KB Output isn't correct
30 Halted 0 ms 0 KB -