Submission #977573

#TimeUsernameProblemLanguageResultExecution timeMemory
977573Halym2007New Home (APIO18_new_home)C++17
5 / 100
5051 ms14320 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 5; int n, k, q, x[N], t[N], a[N], b[N], type[N], l, r; int main () { // freopen ("input.txt", "r", stdin); cin >> n >> k >> q; for (int i = 1; i <= n; ++i) { cin >> x[i] >> t[i] >> a[i] >> b[i]; } while ( q-- ) { cin >> l >> r; for (int i = 1; i <= k; ++i) { type[i] = -1; } for (int i = 1; i <= n; ++i) { if (a[i] <= r and r <= b[i]) { if (type[t[i]] == -1) { type[t[i]] = abs (l - x[i]); } else { type[t[i]] = min (type[t[i]], abs (l - x[i])); } } } int jog = 0; for (int i = 1; i <= k; ++i) { jog = max (jog, type[i]); if (type[i] == -1) { jog = -1; break; } } cout << jog << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...