Submission #698656

#TimeUsernameProblemLanguageResultExecution timeMemory
698656vjudge1New Home (APIO18_new_home)C++17
5 / 100
5101 ms10196 KiB
#include <bits/stdc++.h> ///#include <fstream> #define endl '\n' #define mod 998244353 #define INF 100000000000000 #define ll long long ///#define cin fin ///#define cout fout #define fi first #define se second using namespace std; ///ofstream fout("herding.out"); ///ifstream fin("herding.in"); int main() { ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0); int n, k, q; cin >> n >> k >> q; pair<pair<long long, int>,pair<long long, long long>> arr[n]; for(int i = 0; i < n; i++) { cin >> arr[i].fi.fi >> arr[i].fi.se >> arr[i].se.fi >> arr[i].se.se; } while(q--) { long long ans = 0; long long dis[k+1]; for(int i = 1; i <= k; i++) dis[i] = INF; long long pos, y; cin >> pos >> y; for(int i = 0; i < n; i++) { if(arr[i].se.fi <= y && arr[i].se.se >= y) dis[arr[i].fi.se] = min(dis[arr[i].fi.se],abs(arr[i].fi.fi-pos)); } for(int i = 1; i <= k; i++) { if(dis[i] == INF) { ans = -1; break; } else { ans = max(ans,dis[i]); } } cout << ans << endl; } return 0; }
#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...