Submission #481782

#TimeUsernameProblemLanguageResultExecution timeMemory
481782Yazan_AlattarTrampoline (info1cup20_trampoline)C++14
23 / 100
2 ms1164 KiB
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <utility>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
const int M = 1007;
const ll inf = 1e18;
const ll mod = 1e9 + 7;
const double pi = acos(-1);
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int n, r, c, a[M][M];

int main()
{
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin >> r >> c >> n;
    for(int i = 1; i <= n; ++i){
        int x, y;
        cin >> x >> y;
        a[x][y] = 1;
    }
    int q;
    cin >> q;
    while(q--){
        int i, j, eni, enj;
        cin >> i >> j >> eni >> enj;
        while(j <= c){
            if(i == eni && j == enj) break;
            if(a[i][j] && eni > i) ++i;
            else ++j;
        }
        if(i != eni || j != enj) cout << "No\n";
        else cout << "Yes\n";
    }
    return 0;
}
// Don't forget special cases. (n = 1?)
// Look for the constraints. (Runtime array? overflow?)
#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...