Submission #946085

# Submission time Handle Problem Language Result Execution time Memory
946085 2024-03-14T10:00:33 Z itslq New Home (APIO18_new_home) C++17
0 / 100
5000 ms 7536 KB
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;

int main() {
    int N, K, Q, L, Y;
    cin >> N >> K >> Q;

    vector<int> X(N), T(N), A(N), B(N);
    for (int i = 0; i < N; i++) cin >> X[i] >> T[i] >> A[i] >> B[i];

    while (Q--) {
        cin >> L >> Y;

        unordered_map<int, int> stores;

        for (int i = 0; i < N; i++) {
            if (A[i] <= Y && Y <= B[i]) {
                stores[T[i]] = max(abs(L - X[i]), stores[T[i]]);
            }
        }

        int M = -1;
        for (pair<int, int> x: stores) {
            M = max(M, x.second);
        }

        cout << M << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5012 ms 7536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5042 ms 5640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -