Submission #1043334

#TimeUsernameProblemLanguageResultExecution timeMemory
1043334vjudge1New Home (APIO18_new_home)C++17
5 / 100
5091 ms23392 KiB
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10; int n, k, q, a[N][4]; vector<int> store[N]; int main(){ cin >> n >> k >> q; for (int i = 0; i < n; i ++){ for (int j = 0; j < 4; j ++) cin >> a[i][j]; store[a[i][1]].push_back(i); } for (int i = 0; i < q; i ++){ int l, y; cin >> l >> y; int mx = 0; for (int t = 1; t <= k; t ++){ int mn = 1e9; for (int x : store[t]){ if (a[x][2] <= y and y <= a[x][3]) mn = min(mn, abs(a[x][0] - l)); } mx = max(mx, mn); } if (mx == 1e9) cout << -1 << endl; else cout << mx << endl; } }
#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...