Submission #710010

# Submission time Handle Problem Language Result Execution time Memory
710010 2023-03-15T03:09:39 Z vjudge1 New Home (APIO18_new_home) C++17
0 / 100
5000 ms 13844 KB
/*
Author : DeMen100ns (a.k.a Vo Khac Trieu)
School : VNU-HCM High school for the Gifted
fuck you adhoc
*/

#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

const int N = 3e5 + 5;
const long long INF = 1e18 + 7;
const int MAXA = 1e9;
const int B = sqrt(N) + 5;

array<int, 4> a[N];
array<int, 3> qu[N];
int dist[N];

void solve()
{
    int n, k, q; cin >> n >> k >> q;
    
    for(int i = 1; i <= n; ++i){
        int x, t, l, r; cin >> x >> t >> l >> r;
        a[i] = {x, t, l, r};
    }

    for(int i = 1; i <= q; ++i){
        int l, y; cin >> l >> y;
        
        for(int j = 1; j <= k; ++j){
            dist[j] = MAXA;
        }
        for(int i = 1; i <= n; ++i){
            int x = a[i][0], t = a[i][1], l = a[i][2], r = a[i][3];
            if (l <= y && y <= r){
                dist[t] = min(dist[t], abs(x - l));
            }
        }
        int ans = 0;
        for(int j = 1; j <= k; ++j){
            ans = max(ans, dist[j]);
        }
        if (ans == MAXA) ans = -1;

        cout << ans << endl;
    }
}

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

    // freopen("codeforces.inp","r",stdin);
    // freopen("codeforces.out","w",stdout);

    int t = 1; // cin >> t;
    while (t--)
    {
        solve();
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5025 ms 13844 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5025 ms 12976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -