답안 #217686

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
217686 2020-03-30T12:25:34 Z Vimmer 새 집 (APIO18_new_home) C++14
0 / 100
5000 ms 7904 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>


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

using namespace std;
//using namespace __gnu_pbds;

typedef long double ld;
typedef long long ll;
typedef short int si;
//typedef tree<int, null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> oredered_set;


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(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;

        set <int> se; se.clear();

        int mx = 0;

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

            se.insert(g[i].F.F.S);

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

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

        cout << mx << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5082 ms 7904 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5063 ms 5368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Incorrect 5 ms 384 KB Output isn't correct
5 Halted 0 ms 0 KB -