Submission #393339

#TimeUsernameProblemLanguageResultExecution timeMemory
393339Nima_NaderiNew Home (APIO18_new_home)C++14
5 / 100
2 ms588 KiB
//In the name of God //#pragma GCC optimize("O2") #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll MXN = 400 + 10; ll n, k, q; ll X[MXN], T[MXN], A[MXN], B[MXN], mn[MXN]; int main(){ ios::sync_with_stdio(0);cin.tie(0); cout.tie(0); cin >> n >> k >> q; for(int i = 1; i <= n; i ++) cin >> X[i] >> T[i] >> A[i] >> B[i]; for(int i = 1; i <= q; i ++){ ll p, y, ans = 0; cin >> p >> y; memset(mn, 63, sizeof mn); for(int j = 1; j <= n; j ++){ if(A[j] <= y && y <= B[j]){ //cout << "! " << j << '\n'; //cout << abs(X[j] - p) << '-' << '\n'; mn[T[j]] = min(mn[T[j]], abs(X[j] - p)); } } for(int j = 1; j <= k; j ++) ans = max(ans, mn[j]); if(ans >= 1e18) ans = -1; cout << ans << '\n'; } return 0; } //! N.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...