Submission #250896

#TimeUsernameProblemLanguageResultExecution timeMemory
250896akarinkofStrange Device (APIO19_strange_device)C++14
0 / 100
184 ms2040 KiB
#include<bits/stdc++.h> #include<iostream> #define rep(i,n) for(int i=0;i<n;++i) #define rrep(i,n) for(int i=n-1;i>=0;--i) #define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} #define MAX_N 1002 #define i197 1000000007 using namespace std; typedef long long ll; typedef pair<ll,ll> P1; typedef pair<int,int> Pi; typedef pair<double,Pi> Pdi; typedef pair<ll,int>Pli; typedef pair<P1,ll> P2; typedef pair<string,string> Ps; const ll INF=1000000000000000001; struct edge{int to,cost;}; int dy[]={0, 0, 1, -1}; int dx[]={1, -1, 0, 0}; struct Road{double cost;int a,b;}; struct pos{ // 1 変数を入れる; int x,y,sx,sy,cost; }; ll x[300001],t[300001],a[300001],b[300001]; ll l[300001],y[300001]; int main() { ll n,k,q; cin>>n>>k>>q; rep(i,n)cin>>x[i]>>t[i]>>a[i]>>b[i]; rep(i,q){ cin>>l[i]>>y[i]; int f[300001]={}; ll mi=0; ll z=0; rep(j,n){ if(a[j]<=y[i]&&y[i]<=b[j]){ if(f[t[j]]==0){ f[t[j]]=1; z++; } mi=max(mi,abs(x[j]-l[i])); } } if(z!=k)cout<<"-1"<<endl; else cout<<mi<<endl; } return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...