#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 ma[300001]={};
ll mi=0;
ll z=0;
rep(j,n){
if(a[j]<=y[i]&&y[i]<=b[j]){
if(f[t[j]]==0){
ma[t[j]]=abs(x[j]-l[i]);
f[t[j]]=1;
z++;
}
ma[t[j]]=min(abs(x[j]-l[i]),ma[t[j]]);
}
}
rep(s,k)mi=max(mi,ma[s+1]);
if(z!=k)cout<<"-1"<<endl;
else cout<<mi<<endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
3840 KB |
Output is correct |
2 |
Correct |
2 ms |
3840 KB |
Output is correct |
3 |
Correct |
4 ms |
3840 KB |
Output is correct |
4 |
Correct |
6 ms |
3840 KB |
Output is correct |
5 |
Correct |
47 ms |
4096 KB |
Output is correct |
6 |
Correct |
46 ms |
3968 KB |
Output is correct |
7 |
Correct |
47 ms |
3968 KB |
Output is correct |
8 |
Correct |
45 ms |
3968 KB |
Output is correct |
9 |
Correct |
46 ms |
3968 KB |
Output is correct |
10 |
Correct |
48 ms |
3968 KB |
Output is correct |
11 |
Correct |
47 ms |
3968 KB |
Output is correct |
12 |
Correct |
45 ms |
3968 KB |
Output is correct |
13 |
Correct |
46 ms |
3968 KB |
Output is correct |
14 |
Correct |
45 ms |
3968 KB |
Output is correct |
15 |
Correct |
46 ms |
3968 KB |
Output is correct |
16 |
Correct |
57 ms |
4096 KB |
Output is correct |
17 |
Correct |
47 ms |
3968 KB |
Output is correct |
18 |
Correct |
46 ms |
3968 KB |
Output is correct |
19 |
Correct |
48 ms |
3968 KB |
Output is correct |
20 |
Correct |
46 ms |
3968 KB |
Output is correct |
21 |
Correct |
47 ms |
3976 KB |
Output is correct |
22 |
Correct |
49 ms |
3968 KB |
Output is correct |
23 |
Correct |
47 ms |
3968 KB |
Output is correct |
24 |
Correct |
48 ms |
3968 KB |
Output is correct |
25 |
Correct |
48 ms |
3968 KB |
Output is correct |
26 |
Correct |
45 ms |
3968 KB |
Output is correct |
27 |
Correct |
45 ms |
3968 KB |
Output is correct |
28 |
Correct |
46 ms |
3968 KB |
Output is correct |
29 |
Correct |
49 ms |
3968 KB |
Output is correct |
30 |
Correct |
46 ms |
3968 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
3840 KB |
Output is correct |
2 |
Correct |
2 ms |
3840 KB |
Output is correct |
3 |
Correct |
4 ms |
3840 KB |
Output is correct |
4 |
Correct |
6 ms |
3840 KB |
Output is correct |
5 |
Correct |
47 ms |
4096 KB |
Output is correct |
6 |
Correct |
46 ms |
3968 KB |
Output is correct |
7 |
Correct |
47 ms |
3968 KB |
Output is correct |
8 |
Correct |
45 ms |
3968 KB |
Output is correct |
9 |
Correct |
46 ms |
3968 KB |
Output is correct |
10 |
Correct |
48 ms |
3968 KB |
Output is correct |
11 |
Correct |
47 ms |
3968 KB |
Output is correct |
12 |
Correct |
45 ms |
3968 KB |
Output is correct |
13 |
Correct |
46 ms |
3968 KB |
Output is correct |
14 |
Correct |
45 ms |
3968 KB |
Output is correct |
15 |
Correct |
46 ms |
3968 KB |
Output is correct |
16 |
Correct |
57 ms |
4096 KB |
Output is correct |
17 |
Correct |
47 ms |
3968 KB |
Output is correct |
18 |
Correct |
46 ms |
3968 KB |
Output is correct |
19 |
Correct |
48 ms |
3968 KB |
Output is correct |
20 |
Correct |
46 ms |
3968 KB |
Output is correct |
21 |
Correct |
47 ms |
3976 KB |
Output is correct |
22 |
Correct |
49 ms |
3968 KB |
Output is correct |
23 |
Correct |
47 ms |
3968 KB |
Output is correct |
24 |
Correct |
48 ms |
3968 KB |
Output is correct |
25 |
Correct |
48 ms |
3968 KB |
Output is correct |
26 |
Correct |
45 ms |
3968 KB |
Output is correct |
27 |
Correct |
45 ms |
3968 KB |
Output is correct |
28 |
Correct |
46 ms |
3968 KB |
Output is correct |
29 |
Correct |
49 ms |
3968 KB |
Output is correct |
30 |
Correct |
46 ms |
3968 KB |
Output is correct |
31 |
Execution timed out |
5053 ms |
8584 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5054 ms |
21896 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
5040 ms |
21500 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
3840 KB |
Output is correct |
2 |
Correct |
2 ms |
3840 KB |
Output is correct |
3 |
Correct |
4 ms |
3840 KB |
Output is correct |
4 |
Correct |
6 ms |
3840 KB |
Output is correct |
5 |
Correct |
47 ms |
4096 KB |
Output is correct |
6 |
Correct |
46 ms |
3968 KB |
Output is correct |
7 |
Correct |
47 ms |
3968 KB |
Output is correct |
8 |
Correct |
45 ms |
3968 KB |
Output is correct |
9 |
Correct |
46 ms |
3968 KB |
Output is correct |
10 |
Correct |
48 ms |
3968 KB |
Output is correct |
11 |
Correct |
47 ms |
3968 KB |
Output is correct |
12 |
Correct |
45 ms |
3968 KB |
Output is correct |
13 |
Correct |
46 ms |
3968 KB |
Output is correct |
14 |
Correct |
45 ms |
3968 KB |
Output is correct |
15 |
Correct |
46 ms |
3968 KB |
Output is correct |
16 |
Correct |
57 ms |
4096 KB |
Output is correct |
17 |
Correct |
47 ms |
3968 KB |
Output is correct |
18 |
Correct |
46 ms |
3968 KB |
Output is correct |
19 |
Correct |
48 ms |
3968 KB |
Output is correct |
20 |
Correct |
46 ms |
3968 KB |
Output is correct |
21 |
Correct |
47 ms |
3976 KB |
Output is correct |
22 |
Correct |
49 ms |
3968 KB |
Output is correct |
23 |
Correct |
47 ms |
3968 KB |
Output is correct |
24 |
Correct |
48 ms |
3968 KB |
Output is correct |
25 |
Correct |
48 ms |
3968 KB |
Output is correct |
26 |
Correct |
45 ms |
3968 KB |
Output is correct |
27 |
Correct |
45 ms |
3968 KB |
Output is correct |
28 |
Correct |
46 ms |
3968 KB |
Output is correct |
29 |
Correct |
49 ms |
3968 KB |
Output is correct |
30 |
Correct |
46 ms |
3968 KB |
Output is correct |
31 |
Execution timed out |
5053 ms |
8584 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
3840 KB |
Output is correct |
2 |
Correct |
2 ms |
3840 KB |
Output is correct |
3 |
Correct |
4 ms |
3840 KB |
Output is correct |
4 |
Correct |
6 ms |
3840 KB |
Output is correct |
5 |
Correct |
47 ms |
4096 KB |
Output is correct |
6 |
Correct |
46 ms |
3968 KB |
Output is correct |
7 |
Correct |
47 ms |
3968 KB |
Output is correct |
8 |
Correct |
45 ms |
3968 KB |
Output is correct |
9 |
Correct |
46 ms |
3968 KB |
Output is correct |
10 |
Correct |
48 ms |
3968 KB |
Output is correct |
11 |
Correct |
47 ms |
3968 KB |
Output is correct |
12 |
Correct |
45 ms |
3968 KB |
Output is correct |
13 |
Correct |
46 ms |
3968 KB |
Output is correct |
14 |
Correct |
45 ms |
3968 KB |
Output is correct |
15 |
Correct |
46 ms |
3968 KB |
Output is correct |
16 |
Correct |
57 ms |
4096 KB |
Output is correct |
17 |
Correct |
47 ms |
3968 KB |
Output is correct |
18 |
Correct |
46 ms |
3968 KB |
Output is correct |
19 |
Correct |
48 ms |
3968 KB |
Output is correct |
20 |
Correct |
46 ms |
3968 KB |
Output is correct |
21 |
Correct |
47 ms |
3976 KB |
Output is correct |
22 |
Correct |
49 ms |
3968 KB |
Output is correct |
23 |
Correct |
47 ms |
3968 KB |
Output is correct |
24 |
Correct |
48 ms |
3968 KB |
Output is correct |
25 |
Correct |
48 ms |
3968 KB |
Output is correct |
26 |
Correct |
45 ms |
3968 KB |
Output is correct |
27 |
Correct |
45 ms |
3968 KB |
Output is correct |
28 |
Correct |
46 ms |
3968 KB |
Output is correct |
29 |
Correct |
49 ms |
3968 KB |
Output is correct |
30 |
Correct |
46 ms |
3968 KB |
Output is correct |
31 |
Execution timed out |
5053 ms |
8584 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |