Submission #217689

# Submission time Handle Problem Language Result Execution time Memory
217689 2020-03-30T12:35:37 Z Vimmer New Home (APIO18_new_home) C++14
0 / 100
5000 ms 5732 KB
#include <bits/stdc++.h>

#define F first
#define S second
#define sz(x) int(x.size())
#define N 100005
#define M ll(998244353)

using namespace std;

typedef long double ld;
typedef long long ll;
typedef short int si;


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

    int n, q, k;

    cin >> n >> k >> q;

    vector <pair <pair <pair <int, int>, int>, int> > g; g.resize(n);

    for (int i = 0; i < n; i++) cin >> g[i].F.F.F >> g[i].F.F.S >> g[i].F.S >> g[i].S;

    for (;q > 0; q--)
    {
        int x, y;

        cin >> x >> y;

        int mk[k + 1];

        for (int i = 0; i <= k; i++) mk[i] = 0;

        int mx = 0, kol = 0;

        for (int i = 0; i < n; i++)
        {
            if (y < g[i].F.S  || g[i].S < y) continue;

            if (!mk[g[i].F.F.S]) {mk[g[i].F.F.S] = 1; kol++;}

            mx = max(mx, abs(x - g[i].F.F.F));
        }

        if (kol != k) {cout << -1 << endl; continue;}

        cout << mx << endl;
    }
}
# 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 5 ms 384 KB Output is correct
4 Incorrect 4 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 5 ms 384 KB Output is correct
4 Incorrect 4 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5064 ms 5732 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5073 ms 5392 KB Time limit exceeded
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 5 ms 384 KB Output is correct
4 Incorrect 4 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 5 ms 384 KB Output is correct
4 Incorrect 4 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -