#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio();cin.tie();cout.tie();
#define en cout<<endl;
#define ops cout<<"ops"<<endl;
#define line cout<<"---------------------------"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pllll;
typedef string str;
const ll DIM = 4e2 + 7;
const ll DIMM = 1e2 + 7;
const ll DDIM = 7;
const ll INF = 1e18 + 7;
const ll X = 1e5 + 7;
const ll BS = 2e5 + 7;
const ll AS = 26 + 7;
const ll MODULO = 1e9 + 7;
ll nt,n,m,k,q;
ll val,val1;
ll x,type,t1,t2;
ll ye;
struct z{
ll x,t1,t2;
};
vector<z> a[DIM];
ll cres,res;
int main()
{
fast;
//ll x1,y1,x2,y2;
cin>>n>>m>>k;
for(int i=1;i<=n;i++){
cin>>x>>type>>t1>>t2;
a[type].push_back({x,t1,t2});
}
for(int j=1;j<=k;j++){
cin>>x>>ye;
res=0;
for(int i=1;i<=m;i++){
cres=INF;
for(auto v:a[i]){
if(v.t1>ye || ye>v.t2)continue;
cres=min(cres,abs(x-v.x));
}
res=max(res,cres);
}
if(res==INF)cout<<-1<<endl;
else cout<<res<<endl;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
3 ms |
204 KB |
Output is correct |
8 |
Correct |
3 ms |
204 KB |
Output is correct |
9 |
Correct |
3 ms |
204 KB |
Output is correct |
10 |
Correct |
3 ms |
332 KB |
Output is correct |
11 |
Correct |
3 ms |
204 KB |
Output is correct |
12 |
Correct |
3 ms |
204 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
204 KB |
Output is correct |
15 |
Correct |
3 ms |
204 KB |
Output is correct |
16 |
Correct |
3 ms |
204 KB |
Output is correct |
17 |
Correct |
3 ms |
204 KB |
Output is correct |
18 |
Correct |
3 ms |
204 KB |
Output is correct |
19 |
Correct |
3 ms |
204 KB |
Output is correct |
20 |
Correct |
3 ms |
204 KB |
Output is correct |
21 |
Correct |
2 ms |
204 KB |
Output is correct |
22 |
Correct |
3 ms |
204 KB |
Output is correct |
23 |
Correct |
3 ms |
204 KB |
Output is correct |
24 |
Correct |
3 ms |
204 KB |
Output is correct |
25 |
Correct |
3 ms |
204 KB |
Output is correct |
26 |
Correct |
2 ms |
204 KB |
Output is correct |
27 |
Correct |
2 ms |
204 KB |
Output is correct |
28 |
Correct |
3 ms |
332 KB |
Output is correct |
29 |
Correct |
2 ms |
204 KB |
Output is correct |
30 |
Correct |
2 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
3 ms |
204 KB |
Output is correct |
8 |
Correct |
3 ms |
204 KB |
Output is correct |
9 |
Correct |
3 ms |
204 KB |
Output is correct |
10 |
Correct |
3 ms |
332 KB |
Output is correct |
11 |
Correct |
3 ms |
204 KB |
Output is correct |
12 |
Correct |
3 ms |
204 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
204 KB |
Output is correct |
15 |
Correct |
3 ms |
204 KB |
Output is correct |
16 |
Correct |
3 ms |
204 KB |
Output is correct |
17 |
Correct |
3 ms |
204 KB |
Output is correct |
18 |
Correct |
3 ms |
204 KB |
Output is correct |
19 |
Correct |
3 ms |
204 KB |
Output is correct |
20 |
Correct |
3 ms |
204 KB |
Output is correct |
21 |
Correct |
2 ms |
204 KB |
Output is correct |
22 |
Correct |
3 ms |
204 KB |
Output is correct |
23 |
Correct |
3 ms |
204 KB |
Output is correct |
24 |
Correct |
3 ms |
204 KB |
Output is correct |
25 |
Correct |
3 ms |
204 KB |
Output is correct |
26 |
Correct |
2 ms |
204 KB |
Output is correct |
27 |
Correct |
2 ms |
204 KB |
Output is correct |
28 |
Correct |
3 ms |
332 KB |
Output is correct |
29 |
Correct |
2 ms |
204 KB |
Output is correct |
30 |
Correct |
2 ms |
204 KB |
Output is correct |
31 |
Execution timed out |
5054 ms |
3260 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
3 ms |
204 KB |
Output is correct |
8 |
Correct |
3 ms |
204 KB |
Output is correct |
9 |
Correct |
3 ms |
204 KB |
Output is correct |
10 |
Correct |
3 ms |
332 KB |
Output is correct |
11 |
Correct |
3 ms |
204 KB |
Output is correct |
12 |
Correct |
3 ms |
204 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
204 KB |
Output is correct |
15 |
Correct |
3 ms |
204 KB |
Output is correct |
16 |
Correct |
3 ms |
204 KB |
Output is correct |
17 |
Correct |
3 ms |
204 KB |
Output is correct |
18 |
Correct |
3 ms |
204 KB |
Output is correct |
19 |
Correct |
3 ms |
204 KB |
Output is correct |
20 |
Correct |
3 ms |
204 KB |
Output is correct |
21 |
Correct |
2 ms |
204 KB |
Output is correct |
22 |
Correct |
3 ms |
204 KB |
Output is correct |
23 |
Correct |
3 ms |
204 KB |
Output is correct |
24 |
Correct |
3 ms |
204 KB |
Output is correct |
25 |
Correct |
3 ms |
204 KB |
Output is correct |
26 |
Correct |
2 ms |
204 KB |
Output is correct |
27 |
Correct |
2 ms |
204 KB |
Output is correct |
28 |
Correct |
3 ms |
332 KB |
Output is correct |
29 |
Correct |
2 ms |
204 KB |
Output is correct |
30 |
Correct |
2 ms |
204 KB |
Output is correct |
31 |
Execution timed out |
5054 ms |
3260 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
2 ms |
332 KB |
Output is correct |
6 |
Correct |
3 ms |
204 KB |
Output is correct |
7 |
Correct |
3 ms |
204 KB |
Output is correct |
8 |
Correct |
3 ms |
204 KB |
Output is correct |
9 |
Correct |
3 ms |
204 KB |
Output is correct |
10 |
Correct |
3 ms |
332 KB |
Output is correct |
11 |
Correct |
3 ms |
204 KB |
Output is correct |
12 |
Correct |
3 ms |
204 KB |
Output is correct |
13 |
Correct |
2 ms |
332 KB |
Output is correct |
14 |
Correct |
2 ms |
204 KB |
Output is correct |
15 |
Correct |
3 ms |
204 KB |
Output is correct |
16 |
Correct |
3 ms |
204 KB |
Output is correct |
17 |
Correct |
3 ms |
204 KB |
Output is correct |
18 |
Correct |
3 ms |
204 KB |
Output is correct |
19 |
Correct |
3 ms |
204 KB |
Output is correct |
20 |
Correct |
3 ms |
204 KB |
Output is correct |
21 |
Correct |
2 ms |
204 KB |
Output is correct |
22 |
Correct |
3 ms |
204 KB |
Output is correct |
23 |
Correct |
3 ms |
204 KB |
Output is correct |
24 |
Correct |
3 ms |
204 KB |
Output is correct |
25 |
Correct |
3 ms |
204 KB |
Output is correct |
26 |
Correct |
2 ms |
204 KB |
Output is correct |
27 |
Correct |
2 ms |
204 KB |
Output is correct |
28 |
Correct |
3 ms |
332 KB |
Output is correct |
29 |
Correct |
2 ms |
204 KB |
Output is correct |
30 |
Correct |
2 ms |
204 KB |
Output is correct |
31 |
Execution timed out |
5054 ms |
3260 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |