Submission #481782

# Submission time Handle Problem Language Result Execution time Memory
481782 2021-10-21T22:46:46 Z Yazan_Alattar Trampoline (info1cup20_trampoline) C++14
23 / 100
2 ms 1164 KB
#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 time Memory Grader output
1 Correct 2 ms 1100 KB 200 token(s): yes count is 21, no count is 179
2 Correct 2 ms 1100 KB 200 token(s): yes count is 70, no count is 130
3 Correct 1 ms 1164 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 404 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -