Submission #503977

#TimeUsernameProblemLanguageResultExecution timeMemory
503977bebecanvasTrampoline (info1cup20_trampoline)C++14
0 / 100
556 ms1048580 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define endl '\n' signed main(){ int r, c, n; cin >> r >> c >> n; int g[r][c]; for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ g[i][j]=0; } } for(int i=0; i<n; i++){ int a, b; cin >> a >> b; a--; b--; g[a][b]= 1; } for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ if(i==0&&j==0){continue;} if(i==0){g[i][j]= g[i][j]+ g[i][j-1]; continue;} if(j==0){g[i][j]= g[i][j]+ g[i-1][j]; continue;} g[i][j]= g[i][j]+ g[i-1][j]+ g[i][j-1]- g[i-1][j-1]; } } /* for(int i=0; i<r; i++){ for(int j=0; j<c; j++){ cout << g[i][j] << " "; }cout << endl; }*/ int q; cin >> q; for(int i=0; i<q; i++){ int a, b, c, d; cin >> a >> b >> c >> d; a--; b--; c--; d--; if(a>c||b>d){cout << "No" << endl; continue;} int lol=0; if(a==0&&b==0){lol= g[c][d];} else if(a==0){lol= g[c][d]- g[c][b-1];} else if(b==0){lol= g[c][d]- g[a-1][d];} else{lol= g[c][d]- g[c][b-1]- g[a-1][d]+ g[a-1][b-1];} int e= c-a; if(lol>=e){cout << "Yes" << endl;} else{cout << "No" << endl;} } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...