답안 #702306

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
702306 2023-02-23T13:47:11 Z josanneo22 새 집 (APIO18_new_home) C++17
0 / 100
5000 ms 5268 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    while (t--) {
        int n, type, q;
        cin >> n >> type >> q;
        vector<int> loc(n+3), tp(n + 3), st(n + 3), ed(n + 3);
        for (int i = 0; i < n; i++) {
            cin >> loc[i] >> tp[i] >> st[i] >> ed[i];
        }
        for (int i = 0; i < q; i++) {
            int u, ti; cin >> u >> ti;
            vector<int> cur_type(type + 5, 0);
            int ans = -1;
            for (int j = 0; j < n; j++) {
                if (st[j] <= ti && ed[j] >= ti) {
                    ans = max(ans, abs(u - loc[j]));
                    cur_type[tp[j]]++;
                }
            }
            int ok = 1;
            for (int p = 1; p <= type; p++) {
                if (cur_type[p] == 0) ok = 0;
            }
            if (ok == 0) cout << "-1\n";
            else cout << ans << '\n';
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5056 ms 5268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 5059 ms 5024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -