Submission #508777

#TimeUsernameProblemLanguageResultExecution timeMemory
508777nichkeFurniture (JOI20_furniture)C++14
0 / 100
2 ms720 KiB
// 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...