This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// I may fail a thousand times
// But there is no giving up
// IOI - here I come
#include <bits/stdc++.h>
using namespace std;
int n,m;
map<int,int> cnt;
int a[(int)1e3+5][(int)1e3+5];
signed main(){
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>n>>m;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
cnt[i+j]++;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(a[i][j]){
cnt[i+j]--;
}
}
}
int q;cin>>q;
for(;q;q--){
int x,y;cin>>x>>y;
x--;y--;
if(cnt[x+y]==1)cout<<0<<'\n';
else{
cnt[x+y]--;
cout<<1<<'\n';
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |