답안 #965320

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
965320 2024-04-18T10:30:50 Z pcc Cell Automaton (JOI23_cell) C++17
4 / 100
8000 ms 32600 KB
#include <bits/stdc++.h>
using namespace std;

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

const int mxn = 2020;
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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 456 ms 32348 KB Output is correct
2 Correct 458 ms 32372 KB Output is correct
3 Correct 468 ms 32376 KB Output is correct
4 Correct 461 ms 32372 KB Output is correct
5 Correct 461 ms 32376 KB Output is correct
6 Correct 443 ms 32376 KB Output is correct
7 Correct 453 ms 32380 KB Output is correct
8 Correct 469 ms 32376 KB Output is correct
9 Correct 474 ms 32376 KB Output is correct
10 Correct 493 ms 32376 KB Output is correct
11 Correct 472 ms 32376 KB Output is correct
12 Correct 469 ms 32376 KB Output is correct
13 Correct 466 ms 32376 KB Output is correct
14 Correct 473 ms 32384 KB Output is correct
15 Correct 471 ms 32380 KB Output is correct
16 Correct 465 ms 32372 KB Output is correct
17 Correct 475 ms 32376 KB Output is correct
18 Correct 469 ms 32376 KB Output is correct
19 Correct 475 ms 32372 KB Output is correct
20 Correct 471 ms 32344 KB Output is correct
21 Correct 452 ms 32376 KB Output is correct
22 Correct 463 ms 32376 KB Output is correct
23 Correct 480 ms 32376 KB Output is correct
24 Correct 459 ms 32600 KB Output is correct
25 Correct 474 ms 32376 KB Output is correct
26 Correct 456 ms 32372 KB Output is correct
27 Correct 467 ms 32376 KB Output is correct
28 Correct 468 ms 32596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 456 ms 32348 KB Output is correct
2 Correct 458 ms 32372 KB Output is correct
3 Correct 468 ms 32376 KB Output is correct
4 Correct 461 ms 32372 KB Output is correct
5 Correct 461 ms 32376 KB Output is correct
6 Correct 443 ms 32376 KB Output is correct
7 Correct 453 ms 32380 KB Output is correct
8 Correct 469 ms 32376 KB Output is correct
9 Correct 474 ms 32376 KB Output is correct
10 Correct 493 ms 32376 KB Output is correct
11 Correct 472 ms 32376 KB Output is correct
12 Correct 469 ms 32376 KB Output is correct
13 Correct 466 ms 32376 KB Output is correct
14 Correct 473 ms 32384 KB Output is correct
15 Correct 471 ms 32380 KB Output is correct
16 Correct 465 ms 32372 KB Output is correct
17 Correct 475 ms 32376 KB Output is correct
18 Correct 469 ms 32376 KB Output is correct
19 Correct 475 ms 32372 KB Output is correct
20 Correct 471 ms 32344 KB Output is correct
21 Correct 452 ms 32376 KB Output is correct
22 Correct 463 ms 32376 KB Output is correct
23 Correct 480 ms 32376 KB Output is correct
24 Correct 459 ms 32600 KB Output is correct
25 Correct 474 ms 32376 KB Output is correct
26 Correct 456 ms 32372 KB Output is correct
27 Correct 467 ms 32376 KB Output is correct
28 Correct 468 ms 32596 KB Output is correct
29 Execution timed out 8031 ms 32380 KB Time limit exceeded
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 456 ms 32348 KB Output is correct
2 Correct 458 ms 32372 KB Output is correct
3 Correct 468 ms 32376 KB Output is correct
4 Correct 461 ms 32372 KB Output is correct
5 Correct 461 ms 32376 KB Output is correct
6 Correct 443 ms 32376 KB Output is correct
7 Correct 453 ms 32380 KB Output is correct
8 Correct 469 ms 32376 KB Output is correct
9 Correct 474 ms 32376 KB Output is correct
10 Correct 493 ms 32376 KB Output is correct
11 Correct 472 ms 32376 KB Output is correct
12 Correct 469 ms 32376 KB Output is correct
13 Correct 466 ms 32376 KB Output is correct
14 Correct 473 ms 32384 KB Output is correct
15 Correct 471 ms 32380 KB Output is correct
16 Correct 465 ms 32372 KB Output is correct
17 Correct 475 ms 32376 KB Output is correct
18 Correct 469 ms 32376 KB Output is correct
19 Correct 475 ms 32372 KB Output is correct
20 Correct 471 ms 32344 KB Output is correct
21 Correct 452 ms 32376 KB Output is correct
22 Correct 463 ms 32376 KB Output is correct
23 Correct 480 ms 32376 KB Output is correct
24 Correct 459 ms 32600 KB Output is correct
25 Correct 474 ms 32376 KB Output is correct
26 Correct 456 ms 32372 KB Output is correct
27 Correct 467 ms 32376 KB Output is correct
28 Correct 468 ms 32596 KB Output is correct
29 Execution timed out 8031 ms 32380 KB Time limit exceeded
30 Halted 0 ms 0 KB -