답안 #513545

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
513545 2022-01-17T08:12:26 Z blue 새 집 (APIO18_new_home) C++17
5 / 100
5000 ms 10584 KB
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

using vi = vector<int>;
#define sz(x) int(x.size())


const int mx = 300'000;
const int inf = 1'0000'0001;

int n, k, q;
vi x(1+mx), t(1+mx), a(1+mx), b(1+mx);
vi l(1+mx), y(1+mx);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> k >> q;
    for(int i = 1; i <= n; i++) cin >> x[i] >> t[i] >> a[i] >> b[i];
    for(int j = 1; j <= q; j++) cin >> l[j] >> y[j];

    for(int j = 1; j <= q; j++)
    {
        vi dist(1+k, inf);
        for(int i = 1; i <= n; i++)
        {
            if(a[i] <= y[j] && y[j] <= b[i])
            {
                dist[t[i]] = min(dist[t[i]], abs(x[i] - l[j]));
            }
        }

        int ans = 0;
        for(int z = 1; z <= k; z++) ans = max(ans, dist[z]);
        if(ans >= inf)
            ans = -1;
        cout << ans << '\n';
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 7244 KB Output is correct
2 Correct 4 ms 7264 KB Output is correct
3 Correct 3 ms 7312 KB Output is correct
4 Correct 4 ms 7244 KB Output is correct
5 Correct 5 ms 7244 KB Output is correct
6 Correct 4 ms 7384 KB Output is correct
7 Correct 4 ms 7372 KB Output is correct
8 Correct 5 ms 7380 KB Output is correct
9 Correct 5 ms 7372 KB Output is correct
10 Correct 5 ms 7380 KB Output is correct
11 Correct 4 ms 7372 KB Output is correct
12 Correct 4 ms 7372 KB Output is correct
13 Correct 4 ms 7372 KB Output is correct
14 Correct 3 ms 7372 KB Output is correct
15 Correct 4 ms 7384 KB Output is correct
16 Correct 4 ms 7372 KB Output is correct
17 Correct 3 ms 7372 KB Output is correct
18 Correct 4 ms 7372 KB Output is correct
19 Correct 4 ms 7388 KB Output is correct
20 Correct 5 ms 7372 KB Output is correct
21 Correct 5 ms 7372 KB Output is correct
22 Correct 5 ms 7348 KB Output is correct
23 Correct 6 ms 7372 KB Output is correct
24 Correct 5 ms 7372 KB Output is correct
25 Correct 4 ms 7372 KB Output is correct
26 Correct 5 ms 7372 KB Output is correct
27 Correct 4 ms 7372 KB Output is correct
28 Correct 4 ms 7372 KB Output is correct
29 Correct 4 ms 7372 KB Output is correct
30 Correct 4 ms 7372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 7244 KB Output is correct
2 Correct 4 ms 7264 KB Output is correct
3 Correct 3 ms 7312 KB Output is correct
4 Correct 4 ms 7244 KB Output is correct
5 Correct 5 ms 7244 KB Output is correct
6 Correct 4 ms 7384 KB Output is correct
7 Correct 4 ms 7372 KB Output is correct
8 Correct 5 ms 7380 KB Output is correct
9 Correct 5 ms 7372 KB Output is correct
10 Correct 5 ms 7380 KB Output is correct
11 Correct 4 ms 7372 KB Output is correct
12 Correct 4 ms 7372 KB Output is correct
13 Correct 4 ms 7372 KB Output is correct
14 Correct 3 ms 7372 KB Output is correct
15 Correct 4 ms 7384 KB Output is correct
16 Correct 4 ms 7372 KB Output is correct
17 Correct 3 ms 7372 KB Output is correct
18 Correct 4 ms 7372 KB Output is correct
19 Correct 4 ms 7388 KB Output is correct
20 Correct 5 ms 7372 KB Output is correct
21 Correct 5 ms 7372 KB Output is correct
22 Correct 5 ms 7348 KB Output is correct
23 Correct 6 ms 7372 KB Output is correct
24 Correct 5 ms 7372 KB Output is correct
25 Correct 4 ms 7372 KB Output is correct
26 Correct 5 ms 7372 KB Output is correct
27 Correct 4 ms 7372 KB Output is correct
28 Correct 4 ms 7372 KB Output is correct
29 Correct 4 ms 7372 KB Output is correct
30 Correct 4 ms 7372 KB Output is correct
31 Execution timed out 5046 ms 10584 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5063 ms 7732 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5038 ms 7528 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 7244 KB Output is correct
2 Correct 4 ms 7264 KB Output is correct
3 Correct 3 ms 7312 KB Output is correct
4 Correct 4 ms 7244 KB Output is correct
5 Correct 5 ms 7244 KB Output is correct
6 Correct 4 ms 7384 KB Output is correct
7 Correct 4 ms 7372 KB Output is correct
8 Correct 5 ms 7380 KB Output is correct
9 Correct 5 ms 7372 KB Output is correct
10 Correct 5 ms 7380 KB Output is correct
11 Correct 4 ms 7372 KB Output is correct
12 Correct 4 ms 7372 KB Output is correct
13 Correct 4 ms 7372 KB Output is correct
14 Correct 3 ms 7372 KB Output is correct
15 Correct 4 ms 7384 KB Output is correct
16 Correct 4 ms 7372 KB Output is correct
17 Correct 3 ms 7372 KB Output is correct
18 Correct 4 ms 7372 KB Output is correct
19 Correct 4 ms 7388 KB Output is correct
20 Correct 5 ms 7372 KB Output is correct
21 Correct 5 ms 7372 KB Output is correct
22 Correct 5 ms 7348 KB Output is correct
23 Correct 6 ms 7372 KB Output is correct
24 Correct 5 ms 7372 KB Output is correct
25 Correct 4 ms 7372 KB Output is correct
26 Correct 5 ms 7372 KB Output is correct
27 Correct 4 ms 7372 KB Output is correct
28 Correct 4 ms 7372 KB Output is correct
29 Correct 4 ms 7372 KB Output is correct
30 Correct 4 ms 7372 KB Output is correct
31 Execution timed out 5046 ms 10584 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 7244 KB Output is correct
2 Correct 4 ms 7264 KB Output is correct
3 Correct 3 ms 7312 KB Output is correct
4 Correct 4 ms 7244 KB Output is correct
5 Correct 5 ms 7244 KB Output is correct
6 Correct 4 ms 7384 KB Output is correct
7 Correct 4 ms 7372 KB Output is correct
8 Correct 5 ms 7380 KB Output is correct
9 Correct 5 ms 7372 KB Output is correct
10 Correct 5 ms 7380 KB Output is correct
11 Correct 4 ms 7372 KB Output is correct
12 Correct 4 ms 7372 KB Output is correct
13 Correct 4 ms 7372 KB Output is correct
14 Correct 3 ms 7372 KB Output is correct
15 Correct 4 ms 7384 KB Output is correct
16 Correct 4 ms 7372 KB Output is correct
17 Correct 3 ms 7372 KB Output is correct
18 Correct 4 ms 7372 KB Output is correct
19 Correct 4 ms 7388 KB Output is correct
20 Correct 5 ms 7372 KB Output is correct
21 Correct 5 ms 7372 KB Output is correct
22 Correct 5 ms 7348 KB Output is correct
23 Correct 6 ms 7372 KB Output is correct
24 Correct 5 ms 7372 KB Output is correct
25 Correct 4 ms 7372 KB Output is correct
26 Correct 5 ms 7372 KB Output is correct
27 Correct 4 ms 7372 KB Output is correct
28 Correct 4 ms 7372 KB Output is correct
29 Correct 4 ms 7372 KB Output is correct
30 Correct 4 ms 7372 KB Output is correct
31 Execution timed out 5046 ms 10584 KB Time limit exceeded
32 Halted 0 ms 0 KB -