Submission #921038

# Submission time Handle Problem Language Result Execution time Memory
921038 2024-02-03T09:04:39 Z itslq Trampoline (info1cup20_trampoline) C++17
73 / 100
2000 ms 16244 KB
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    bool can;
    int R, C, T, N, x, y, a, b;
    cin >> R >> C >> N;

    unordered_map<int, vector<int>> green;
    unordered_set<int> tosort;

    while (N--) {
        cin >> x >> y;
        green[x].push_back(y);
        tosort.insert(x);
    }

    for (int n: tosort) {
        sort(green[n].begin(), green[n].end());
    }

    cin >> T;

    while (T--) {
        can = 1;
        cin >> x >> y >> a >> b;

        if (a < x || b < y) {
            cout << "No\n";
            continue;
        }

        for (; x < a; x++) {
            if (green.find(x) == green.end()) {
                can = 0;
                cout << "No\n";
                break;
            }

            auto it = lower_bound(green[x].begin(), green[x].end(), y);
            if (it == green[x].end()) {
                can = 0;
                cout << "No\n";
                break;
            } else if ((y = *it) > b) {
                can = 0;
                cout << "No\n";
                break;
            }
        }

        if (can) {
            cout << "Yes\n";
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB 200 token(s): yes count is 21, no count is 179
2 Correct 2 ms 604 KB 200 token(s): yes count is 70, no count is 130
3 Correct 2 ms 604 KB 197 token(s): yes count is 25, no count is 172
# Verdict Execution time Memory Grader output
1 Correct 41 ms 2128 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 41 ms 3168 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 87 ms 2684 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 104 ms 3308 KB 4000 token(s): yes count is 1991, no count is 2009
# Verdict Execution time Memory Grader output
1 Correct 127 ms 2436 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 135 ms 8600 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 132 ms 8424 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 123 ms 9012 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 124 ms 8944 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 177 ms 16244 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Correct 4 ms 344 KB 5000 token(s): yes count is 3238, no count is 1762
2 Correct 8 ms 604 KB 5000 token(s): yes count is 3837, no count is 1163
3 Correct 5 ms 1372 KB 5000 token(s): yes count is 4104, no count is 896
4 Correct 4 ms 600 KB 5000 token(s): yes count is 3934, no count is 1066
5 Correct 78 ms 968 KB 5000 token(s): yes count is 3384, no count is 1616
6 Correct 4 ms 604 KB 5000 token(s): yes count is 3390, no count is 1610
# Verdict Execution time Memory Grader output
1 Execution timed out 2067 ms 10652 KB Time limit exceeded
2 Halted 0 ms 0 KB -