Submission #965329

# Submission time Handle Problem Language Result Execution time Memory
965329 2024-04-18T10:37:11 Z pcc Cell Automaton (JOI23_cell) C++17
0 / 100
35 ms 50720 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 = 6010;
const int sh = mxn>>1;
int N,Q;
int req[mxn];
pii dir[] = {{-1,0},{1,0},{0,1},{0,-1}};
vector<pii> v;
vector<pii> vv;
int arr[mxn][mxn];
int ans = 0;

void move(){
	ans = 0;
	vv.clear();
	for(auto &i:v){
		for(auto &d:dir){
			if(!arr[i.fs+d.fs][i.sc+d.sc]){
				arr[i.fs+d.fs][i.sc+d.sc] = true;
				vv.push_back(pii(i.fs+d.fs,i.sc+d.sc));
				ans++;
			}
		}
	}
	vv.swap(v);
	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;
		v.push_back(pii(r+sh,c+sh));
	}
	int t = 0;
	while(Q--){
		int k;
		cin>>k;
		while(t<k){
			t++;
			move();
		}
		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 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 536 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 536 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 35 ms 50720 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 35 ms 50720 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -