답안 #217696

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

#define F first
#define S second
#define sz(x) ll(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);

    ll n, k, q;

    cin >> n >> k >> q;

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

    for (ll 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--)
    {
        ll x, y;

        cin >> x >> y;

        ll mk[k + 1];

        for (ll i = 0; i <= k; i++) mk[i] = -1;

        ll mx = 0;

        bool f = 1;

        for (ll i = 0; i < n; i++)
            if (g[i].F.S <= y && y <= g[i].S) mk[g[i].F.F.S] = max(mk[g[i].F.F.S], abs(x - g[i].F.F.F));

        for (int i = 1; i <= k; i++) if (mk[i] == -1) f = 0; else mx = max(mx, mk[i]);

        if (!f) cout << -1 << endl; else cout << mx << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 256 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 4 ms 384 KB Output is correct
2 Correct 4 ms 256 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 5065 ms 10596 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5057 ms 10232 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 256 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 4 ms 384 KB Output is correct
2 Correct 4 ms 256 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 -