제출 #946092

#제출 시각아이디문제언어결과실행 시간메모리
946092itslq새 집 (APIO18_new_home)C++17
0 / 100
5055 ms15300 KiB
#include <bits/stdc++.h> #include <unordered_map> #include <unordered_set> using namespace std; #define int long long signed 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...