Submission #946091

#TimeUsernameProblemLanguageResultExecution timeMemory
946091itslqNew Home (APIO18_new_home)C++17
0 / 100
5045 ms10604 KiB
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; int main() { int N, K, Q, L, Y; cin >> N >> K >> Q; vector<int> X(N), T(N), A(N), B(N); for (int i = 0; i < N; i++) cin >> X[i] >> T[i] >> A[i] >> B[i]; unordered_set<int> types; for (int i = 0; i < N; i++) types.insert(T[i]); while (Q--) { cin >> L >> Y; unordered_map<int, int> stores; for (int i = 0; i < N; i++) { if (A[i] <= Y && Y <= B[i]) { stores[T[i]] = max(abs(L - X[i]), stores[T[i]]); } } if (stores.size() < types.size()) { cout << "-1\n"; continue; } int M = -1; for (pair<int, int> x: stores) { M = max(M, x.second); } cout << M << '\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...