Submission #217557

# Submission time Handle Problem Language Result Execution time Memory
217557 2020-03-30T09:05:12 Z VEGAnn New Home (APIO18_new_home) C++14
0 / 100
5 ms 640 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 410;
int n, k, qq, x[N], t[N], a[N], b[N], mrk[N], tt = 0;

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

//    freopen("in.txt","r",stdin);

    cin >> n >> k >> qq;

    assert(n < 401 && qq < 401);

    for (int i = 0; i < n; i++)
        cin >> x[i] >> t[i] >> a[i] >> b[i];

    for (; qq; qq--){
        int l, y; cin >> l >> y;
        tt++;
        int kol = 0, mx = 0;

        for (int i = 0; i < n; i++){
            if (y < a[i] || y > b[i]) continue;

            if (mrk[t[i]] < tt)
                kol++;
            mrk[t[i]] = tt;

            mx = max(mx, abs(l - x[i]));
        }

        if (kol < k)
            cout << "-1\n";
        else cout << mx << '\n';
    }

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -