Submission #734816

#TimeUsernameProblemLanguageResultExecution timeMemory
734816keisuke6New Home (APIO18_new_home)C++14
5 / 100
5084 ms5892 KiB
#pragma GCC target("avx512f") #include <bits/stdc++.h> using namespace std; int main(){ int N,K,Q; cin>>N>>K>>Q; if(N <= 400 && Q <= 400){ 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]; T[i]--; } while(Q--){ int x,t; cin>>x>>t; vector<int> S(K,2e9); for(int i=0;i<N;i++){ if(A[i] > t || B[i] < t) continue; S[T[i]] = min(S[T[i]],abs(X[i]-x)); } sort(S.rbegin(),S.rend()); cout<<(S[0] == 2e9 ? -1 : S[0])<<endl; } return 0; } 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]; T[i]--; } while(Q--){ int x,t; cin>>x>>t; vector<int> S(K,2e9); for(int i=0;i<N;i++){ if(A[i] > t || B[i] < t) continue; int tt = X[i]-x; if(tt < 0) tt = -tt; //if(S[T[i]] > tt) S[T[i]] = tt; } sort(S.rbegin(),S.rend()); cout<<(S[0] == 2e9 ? -1 : S[0])<<endl; } }
#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...