Submission #979237

#TimeUsernameProblemLanguageResultExecution timeMemory
979237Jarif_RahmanNew Home (APIO18_new_home)C++17
5 / 100
5064 ms16308 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; const int inf = 1e9; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n, k, q; cin >> n >> k >> q; vector<vector<tuple<int, int, int>>> stores(k); for(int i = 0; i < n; i++){ int x, t, a, b; cin >> x >> t >> a >> b; t--; stores[t].push_back({x, a, b}); } while(q--){ int l, y; cin >> l >> y; int ans = 0; for(auto s: stores){ int mn = inf; for(auto [x, a, b]: s) if(a <= y && b >= y) mn = min(mn, abs(l-x)); if(mn == inf){ ans = -1; break; } ans = max(ans, mn); } cout << ans << "\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...