답안 #965323

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
965323 2024-04-18T10:32:17 Z pcc Cell Automaton (JOI23_cell) C++17
4 / 100
6738 ms 32600 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 = 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 330 ms 32344 KB Output is correct
2 Correct 329 ms 32392 KB Output is correct
3 Correct 329 ms 32376 KB Output is correct
4 Correct 327 ms 32348 KB Output is correct
5 Correct 328 ms 32348 KB Output is correct
6 Correct 325 ms 32348 KB Output is correct
7 Correct 325 ms 32376 KB Output is correct
8 Correct 323 ms 32380 KB Output is correct
9 Correct 331 ms 32572 KB Output is correct
10 Correct 328 ms 32344 KB Output is correct
11 Correct 325 ms 32348 KB Output is correct
12 Correct 333 ms 32348 KB Output is correct
13 Correct 330 ms 32200 KB Output is correct
14 Correct 322 ms 32348 KB Output is correct
15 Correct 330 ms 32428 KB Output is correct
16 Correct 319 ms 32380 KB Output is correct
17 Correct 321 ms 32376 KB Output is correct
18 Correct 322 ms 32376 KB Output is correct
19 Correct 319 ms 32348 KB Output is correct
20 Correct 320 ms 32376 KB Output is correct
21 Correct 321 ms 32600 KB Output is correct
22 Correct 321 ms 32380 KB Output is correct
23 Correct 323 ms 32372 KB Output is correct
24 Correct 323 ms 32392 KB Output is correct
25 Correct 321 ms 32348 KB Output is correct
26 Correct 330 ms 32592 KB Output is correct
27 Correct 331 ms 32376 KB Output is correct
28 Correct 329 ms 32372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 330 ms 32344 KB Output is correct
2 Correct 329 ms 32392 KB Output is correct
3 Correct 329 ms 32376 KB Output is correct
4 Correct 327 ms 32348 KB Output is correct
5 Correct 328 ms 32348 KB Output is correct
6 Correct 325 ms 32348 KB Output is correct
7 Correct 325 ms 32376 KB Output is correct
8 Correct 323 ms 32380 KB Output is correct
9 Correct 331 ms 32572 KB Output is correct
10 Correct 328 ms 32344 KB Output is correct
11 Correct 325 ms 32348 KB Output is correct
12 Correct 333 ms 32348 KB Output is correct
13 Correct 330 ms 32200 KB Output is correct
14 Correct 322 ms 32348 KB Output is correct
15 Correct 330 ms 32428 KB Output is correct
16 Correct 319 ms 32380 KB Output is correct
17 Correct 321 ms 32376 KB Output is correct
18 Correct 322 ms 32376 KB Output is correct
19 Correct 319 ms 32348 KB Output is correct
20 Correct 320 ms 32376 KB Output is correct
21 Correct 321 ms 32600 KB Output is correct
22 Correct 321 ms 32380 KB Output is correct
23 Correct 323 ms 32372 KB Output is correct
24 Correct 323 ms 32392 KB Output is correct
25 Correct 321 ms 32348 KB Output is correct
26 Correct 330 ms 32592 KB Output is correct
27 Correct 331 ms 32376 KB Output is correct
28 Correct 329 ms 32372 KB Output is correct
29 Incorrect 6738 ms 32384 KB Output isn't correct
30 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 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 330 ms 32344 KB Output is correct
2 Correct 329 ms 32392 KB Output is correct
3 Correct 329 ms 32376 KB Output is correct
4 Correct 327 ms 32348 KB Output is correct
5 Correct 328 ms 32348 KB Output is correct
6 Correct 325 ms 32348 KB Output is correct
7 Correct 325 ms 32376 KB Output is correct
8 Correct 323 ms 32380 KB Output is correct
9 Correct 331 ms 32572 KB Output is correct
10 Correct 328 ms 32344 KB Output is correct
11 Correct 325 ms 32348 KB Output is correct
12 Correct 333 ms 32348 KB Output is correct
13 Correct 330 ms 32200 KB Output is correct
14 Correct 322 ms 32348 KB Output is correct
15 Correct 330 ms 32428 KB Output is correct
16 Correct 319 ms 32380 KB Output is correct
17 Correct 321 ms 32376 KB Output is correct
18 Correct 322 ms 32376 KB Output is correct
19 Correct 319 ms 32348 KB Output is correct
20 Correct 320 ms 32376 KB Output is correct
21 Correct 321 ms 32600 KB Output is correct
22 Correct 321 ms 32380 KB Output is correct
23 Correct 323 ms 32372 KB Output is correct
24 Correct 323 ms 32392 KB Output is correct
25 Correct 321 ms 32348 KB Output is correct
26 Correct 330 ms 32592 KB Output is correct
27 Correct 331 ms 32376 KB Output is correct
28 Correct 329 ms 32372 KB Output is correct
29 Incorrect 6738 ms 32384 KB Output isn't correct
30 Halted 0 ms 0 KB -