Submission #383295

# Submission time Handle Problem Language Result Execution time Memory
383295 2021-03-29T13:39:16 Z Iwanttobreakfree Topovi (COCI15_topovi) C++17
30 / 120
2 ms 508 KB
#include <iostream>
#include <vector>
using namespace std;
int main(){
	int n,k,p,r,c,x,a,b,a2,b2;
	cin>>n>>k>>p;
	int grid[n][n];
	vector<int> colum(n,0);
	vector<int> fil(n,0);
	while(k--){
		cin>>r>>c>>x;
		r--;c--;
		grid[r][c]=x;
		colum[r]^=x;
		fil[c]^=x;
	}
	int cont=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(colum[i]!=fil[j])cont++;
		}
	}
	//cout<<cont<<' ';
	while(p--){
		cont=0;
		cin>>a>>b>>a2>>b2;
		a--;b--;a2--;b2--;
		x=grid[a][b];
		grid[a][b]=0;
		grid[a2][b2]=x;
		fil[b]^=x;
		colum[a]^=x;
		fil[b2]^=x;
		colum[a2]^=x;
		for(int i=0;i<n;i++){
			for(int j=0;j<n;j++){
				if(colum[i]!=fil[j])cont++;
			}
		}
		cout<<cont<<'\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 364 KB Output is correct
2 Correct 2 ms 492 KB Output is correct
3 Correct 2 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 2 ms 364 KB Output is correct
6 Runtime error 1 ms 492 KB Execution killed with signal 11
7 Runtime error 1 ms 492 KB Execution killed with signal 11
8 Runtime error 1 ms 492 KB Execution killed with signal 11
9 Runtime error 1 ms 492 KB Execution killed with signal 11
10 Runtime error 1 ms 492 KB Execution killed with signal 11
11 Runtime error 2 ms 508 KB Execution killed with signal 7
12 Runtime error 1 ms 492 KB Execution killed with signal 7
13 Runtime error 1 ms 492 KB Execution killed with signal 7
14 Runtime error 1 ms 492 KB Execution killed with signal 7
15 Runtime error 1 ms 492 KB Execution killed with signal 7
16 Runtime error 1 ms 492 KB Execution killed with signal 7
17 Runtime error 1 ms 492 KB Execution killed with signal 7
18 Runtime error 1 ms 492 KB Execution killed with signal 7
19 Runtime error 1 ms 492 KB Execution killed with signal 7
20 Runtime error 1 ms 492 KB Execution killed with signal 7