Submission #702310

# Submission time Handle Problem Language Result Execution time Memory
702310 2023-02-23T13:53:24 Z josanneo22 New Home (APIO18_new_home) C++17
0 / 100
157 ms 11300 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];
        }
        vector<int> cur_type(type + 5, 0);
        int mx = 0, mn = INT_MAX;
        for (int i = 0; i < n; i++) {
            cur_type[tp[i]]++;
            mx = max(mx, loc[i]);
            mn = min(mn, loc[i]);
        }
        int ok = 1;
        for (int i = 1; i <= n; i++) {
            if (cur_type[i] == 0) ok = 0;
        }
        for (int i = 0; i < q; i++) {
            int u, ti; cin >> u >> ti;
            if (ok) cout << max(u - mn, mx - u) << '\n';
            else cout << "-1\n";
            /*
            int ans = -1;
            for (int j = 0; j < n; j++) {
                if (st[j] <= ti && ti<=ed[j]) {
                    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';*/
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 157 ms 11300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 106 ms 10016 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -