Submission #365951

#TimeUsernameProblemLanguageResultExecution timeMemory
365951sobaTrampoline (info1cup20_trampoline)C++14
43 / 100
218 ms49388 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll r , c , n , x , y , a, b, t; cin >> r>> c >> n ; int next[r+1][c+1] , grid[r+1][c+1]={0}; for(int i = 0 ; i < n ; i++) { cin >> x>> y ; grid[x][y]=1; } for(int i = 1 ; i <= r ; i++) { x=c+1; for(int j = c; j>=1 ; j--) { if(grid[i][j])x=j; next[i][j]=x; } } // for(int i = 1 ; i <= r ; i++) // { // x=c+1; // for(int j = 1; j<=c ; j++) // { // cout << next[i][j]<< " "; // } // cout << "\n"; // } cin >> t; while(t--) { cin>> x >> y >> a >> b ; if(x==a) { if(y<=b) { cout << "Yes\n"; } else cout << "No\n"; continue; } int j=y; int impos=1; for(int i = x ; i<a ; i++) { j=next[i][j]; if(j>b) { impos=1; break; } if(i==a-1) { impos=0; } } if(impos) { cout << "No\n"; } else cout << "Yes\n"; } return 0; }
#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...