Submission #1043334

# Submission time Handle Problem Language Result Execution time Memory
1043334 2024-08-04T08:25:56 Z vjudge1 New Home (APIO18_new_home) C++17
5 / 100
5000 ms 23392 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 3e5 + 10;
int n, k, q, a[N][4];
vector<int> store[N];

int main(){
    cin >> n >> k >> q;
    for (int i = 0; i < n; i ++){
        for (int j = 0; j < 4; j ++)
            cin >> a[i][j];
        store[a[i][1]].push_back(i);
    }

    for (int i = 0; i < q; i ++){
        int l, y;
        cin >> l >> y;

        int mx = 0;
        for (int t = 1; t <= k; t ++){
            int mn = 1e9;
            for (int x : store[t]){
                if (a[x][2] <= y and y <= a[x][3])
                    mn = min(mn, abs(a[x][0] - l));
            }
            mx = max(mx, mn);
        }

        if (mx == 1e9)
            cout << -1 << endl;
        else
            cout << mx << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7260 KB Output is correct
2 Correct 3 ms 7260 KB Output is correct
3 Correct 2 ms 7512 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 5 ms 7496 KB Output is correct
6 Correct 3 ms 7516 KB Output is correct
7 Correct 7 ms 7516 KB Output is correct
8 Correct 7 ms 7516 KB Output is correct
9 Correct 4 ms 7516 KB Output is correct
10 Correct 3 ms 7516 KB Output is correct
11 Correct 6 ms 7516 KB Output is correct
12 Correct 4 ms 7516 KB Output is correct
13 Correct 3 ms 7312 KB Output is correct
14 Correct 3 ms 7516 KB Output is correct
15 Correct 3 ms 7516 KB Output is correct
16 Correct 4 ms 7368 KB Output is correct
17 Correct 6 ms 7500 KB Output is correct
18 Correct 4 ms 7516 KB Output is correct
19 Correct 4 ms 7512 KB Output is correct
20 Correct 6 ms 7428 KB Output is correct
21 Correct 4 ms 7516 KB Output is correct
22 Correct 4 ms 7516 KB Output is correct
23 Correct 7 ms 7280 KB Output is correct
24 Correct 6 ms 7516 KB Output is correct
25 Correct 4 ms 7516 KB Output is correct
26 Correct 5 ms 7516 KB Output is correct
27 Correct 4 ms 7260 KB Output is correct
28 Correct 5 ms 7512 KB Output is correct
29 Correct 4 ms 7328 KB Output is correct
30 Correct 4 ms 7516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7260 KB Output is correct
2 Correct 3 ms 7260 KB Output is correct
3 Correct 2 ms 7512 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 5 ms 7496 KB Output is correct
6 Correct 3 ms 7516 KB Output is correct
7 Correct 7 ms 7516 KB Output is correct
8 Correct 7 ms 7516 KB Output is correct
9 Correct 4 ms 7516 KB Output is correct
10 Correct 3 ms 7516 KB Output is correct
11 Correct 6 ms 7516 KB Output is correct
12 Correct 4 ms 7516 KB Output is correct
13 Correct 3 ms 7312 KB Output is correct
14 Correct 3 ms 7516 KB Output is correct
15 Correct 3 ms 7516 KB Output is correct
16 Correct 4 ms 7368 KB Output is correct
17 Correct 6 ms 7500 KB Output is correct
18 Correct 4 ms 7516 KB Output is correct
19 Correct 4 ms 7512 KB Output is correct
20 Correct 6 ms 7428 KB Output is correct
21 Correct 4 ms 7516 KB Output is correct
22 Correct 4 ms 7516 KB Output is correct
23 Correct 7 ms 7280 KB Output is correct
24 Correct 6 ms 7516 KB Output is correct
25 Correct 4 ms 7516 KB Output is correct
26 Correct 5 ms 7516 KB Output is correct
27 Correct 4 ms 7260 KB Output is correct
28 Correct 5 ms 7512 KB Output is correct
29 Correct 4 ms 7328 KB Output is correct
30 Correct 4 ms 7516 KB Output is correct
31 Execution timed out 5091 ms 11188 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5039 ms 23392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5058 ms 21724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7260 KB Output is correct
2 Correct 3 ms 7260 KB Output is correct
3 Correct 2 ms 7512 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 5 ms 7496 KB Output is correct
6 Correct 3 ms 7516 KB Output is correct
7 Correct 7 ms 7516 KB Output is correct
8 Correct 7 ms 7516 KB Output is correct
9 Correct 4 ms 7516 KB Output is correct
10 Correct 3 ms 7516 KB Output is correct
11 Correct 6 ms 7516 KB Output is correct
12 Correct 4 ms 7516 KB Output is correct
13 Correct 3 ms 7312 KB Output is correct
14 Correct 3 ms 7516 KB Output is correct
15 Correct 3 ms 7516 KB Output is correct
16 Correct 4 ms 7368 KB Output is correct
17 Correct 6 ms 7500 KB Output is correct
18 Correct 4 ms 7516 KB Output is correct
19 Correct 4 ms 7512 KB Output is correct
20 Correct 6 ms 7428 KB Output is correct
21 Correct 4 ms 7516 KB Output is correct
22 Correct 4 ms 7516 KB Output is correct
23 Correct 7 ms 7280 KB Output is correct
24 Correct 6 ms 7516 KB Output is correct
25 Correct 4 ms 7516 KB Output is correct
26 Correct 5 ms 7516 KB Output is correct
27 Correct 4 ms 7260 KB Output is correct
28 Correct 5 ms 7512 KB Output is correct
29 Correct 4 ms 7328 KB Output is correct
30 Correct 4 ms 7516 KB Output is correct
31 Execution timed out 5091 ms 11188 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7260 KB Output is correct
2 Correct 3 ms 7260 KB Output is correct
3 Correct 2 ms 7512 KB Output is correct
4 Correct 2 ms 7260 KB Output is correct
5 Correct 5 ms 7496 KB Output is correct
6 Correct 3 ms 7516 KB Output is correct
7 Correct 7 ms 7516 KB Output is correct
8 Correct 7 ms 7516 KB Output is correct
9 Correct 4 ms 7516 KB Output is correct
10 Correct 3 ms 7516 KB Output is correct
11 Correct 6 ms 7516 KB Output is correct
12 Correct 4 ms 7516 KB Output is correct
13 Correct 3 ms 7312 KB Output is correct
14 Correct 3 ms 7516 KB Output is correct
15 Correct 3 ms 7516 KB Output is correct
16 Correct 4 ms 7368 KB Output is correct
17 Correct 6 ms 7500 KB Output is correct
18 Correct 4 ms 7516 KB Output is correct
19 Correct 4 ms 7512 KB Output is correct
20 Correct 6 ms 7428 KB Output is correct
21 Correct 4 ms 7516 KB Output is correct
22 Correct 4 ms 7516 KB Output is correct
23 Correct 7 ms 7280 KB Output is correct
24 Correct 6 ms 7516 KB Output is correct
25 Correct 4 ms 7516 KB Output is correct
26 Correct 5 ms 7516 KB Output is correct
27 Correct 4 ms 7260 KB Output is correct
28 Correct 5 ms 7512 KB Output is correct
29 Correct 4 ms 7328 KB Output is correct
30 Correct 4 ms 7516 KB Output is correct
31 Execution timed out 5091 ms 11188 KB Time limit exceeded
32 Halted 0 ms 0 KB -