답안 #698646

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
698646 2023-02-14T06:44:46 Z vjudge1 새 집 (APIO18_new_home) C++17
0 / 100
5000 ms 16928 KB
#include <bits/stdc++.h>
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
using namespace std;
const int N = 1e8 + 10, mod = 1e9 + 7;
int n, k, q;
vector<int> x, a , b, type;
signed main()
{
    FAST;
    cin >> n >> k >> q;
    for(int i = 0; i < n; i++) {
        int time, t, x1, y1;
        cin >> time >> t >> x1 >> y1;
        x.push_back(time);
        a.push_back(x1);
        b.push_back(y1);
        type.push_back(t);
    }
    while(q--) {
        int l, y;
        cin >> y >> l;
        vector<int> v;
        bool vis[k+1];
        for(int i = 1; i <= k; i++) vis[i] = 0;
        for(int i = 0; i < n; i++) {
            if(a[i] <= l && b[i] >= l) {
                v.push_back(x[i]);
                vis[type[i]] = 1;
            }
        }
        bool ans = 1;
        for(int i = 1; i <= k; i++) if(vis[i] == 0) ans = 0;
        if(!ans) cout << -1 << endl;
        else {
            sort(all(v));
            // cout << v[0] << ' ' << v[v.size() - 1] << ' ' << y << endl;
            cout << max(abs(v[0] - y), abs(v[v.size() - 1] - y)) << endl;
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5060 ms 16928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5039 ms 16832 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 0 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -