Submission #965325

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

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")

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

const int mxn = 3010;
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];
	}
	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';
		/*
		for(auto &i:arr){
			for(auto &j:i)cout<<j;cout<<endl;
		}cout<<endl;
	   */
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 653 ms 71356 KB Output is correct
2 Correct 665 ms 71352 KB Output is correct
3 Correct 678 ms 71356 KB Output is correct
4 Correct 648 ms 71352 KB Output is correct
5 Correct 674 ms 71260 KB Output is correct
6 Correct 681 ms 71356 KB Output is correct
7 Correct 682 ms 71248 KB Output is correct
8 Correct 676 ms 71364 KB Output is correct
9 Correct 667 ms 71368 KB Output is correct
10 Correct 664 ms 71504 KB Output is correct
11 Correct 671 ms 71352 KB Output is correct
12 Correct 679 ms 71252 KB Output is correct
13 Correct 675 ms 71364 KB Output is correct
14 Correct 673 ms 71364 KB Output is correct
15 Correct 668 ms 71364 KB Output is correct
16 Correct 661 ms 71356 KB Output is correct
17 Correct 664 ms 71356 KB Output is correct
18 Correct 666 ms 71352 KB Output is correct
19 Correct 673 ms 71352 KB Output is correct
20 Correct 668 ms 71356 KB Output is correct
21 Correct 667 ms 71356 KB Output is correct
22 Correct 698 ms 71356 KB Output is correct
23 Correct 663 ms 71356 KB Output is correct
24 Correct 667 ms 71360 KB Output is correct
25 Correct 674 ms 71504 KB Output is correct
26 Correct 662 ms 71356 KB Output is correct
27 Correct 670 ms 71356 KB Output is correct
28 Correct 669 ms 71356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 653 ms 71356 KB Output is correct
2 Correct 665 ms 71352 KB Output is correct
3 Correct 678 ms 71356 KB Output is correct
4 Correct 648 ms 71352 KB Output is correct
5 Correct 674 ms 71260 KB Output is correct
6 Correct 681 ms 71356 KB Output is correct
7 Correct 682 ms 71248 KB Output is correct
8 Correct 676 ms 71364 KB Output is correct
9 Correct 667 ms 71368 KB Output is correct
10 Correct 664 ms 71504 KB Output is correct
11 Correct 671 ms 71352 KB Output is correct
12 Correct 679 ms 71252 KB Output is correct
13 Correct 675 ms 71364 KB Output is correct
14 Correct 673 ms 71364 KB Output is correct
15 Correct 668 ms 71364 KB Output is correct
16 Correct 661 ms 71356 KB Output is correct
17 Correct 664 ms 71356 KB Output is correct
18 Correct 666 ms 71352 KB Output is correct
19 Correct 673 ms 71352 KB Output is correct
20 Correct 668 ms 71356 KB Output is correct
21 Correct 667 ms 71356 KB Output is correct
22 Correct 698 ms 71356 KB Output is correct
23 Correct 663 ms 71356 KB Output is correct
24 Correct 667 ms 71360 KB Output is correct
25 Correct 674 ms 71504 KB Output is correct
26 Correct 662 ms 71356 KB Output is correct
27 Correct 670 ms 71356 KB Output is correct
28 Correct 669 ms 71356 KB Output is correct
29 Execution timed out 8042 ms 71360 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 4676 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 4676 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 653 ms 71356 KB Output is correct
2 Correct 665 ms 71352 KB Output is correct
3 Correct 678 ms 71356 KB Output is correct
4 Correct 648 ms 71352 KB Output is correct
5 Correct 674 ms 71260 KB Output is correct
6 Correct 681 ms 71356 KB Output is correct
7 Correct 682 ms 71248 KB Output is correct
8 Correct 676 ms 71364 KB Output is correct
9 Correct 667 ms 71368 KB Output is correct
10 Correct 664 ms 71504 KB Output is correct
11 Correct 671 ms 71352 KB Output is correct
12 Correct 679 ms 71252 KB Output is correct
13 Correct 675 ms 71364 KB Output is correct
14 Correct 673 ms 71364 KB Output is correct
15 Correct 668 ms 71364 KB Output is correct
16 Correct 661 ms 71356 KB Output is correct
17 Correct 664 ms 71356 KB Output is correct
18 Correct 666 ms 71352 KB Output is correct
19 Correct 673 ms 71352 KB Output is correct
20 Correct 668 ms 71356 KB Output is correct
21 Correct 667 ms 71356 KB Output is correct
22 Correct 698 ms 71356 KB Output is correct
23 Correct 663 ms 71356 KB Output is correct
24 Correct 667 ms 71360 KB Output is correct
25 Correct 674 ms 71504 KB Output is correct
26 Correct 662 ms 71356 KB Output is correct
27 Correct 670 ms 71356 KB Output is correct
28 Correct 669 ms 71356 KB Output is correct
29 Execution timed out 8042 ms 71360 KB Time limit exceeded
30 Halted 0 ms 0 KB -