#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define int long long
#define itr ::iterator itr
typedef pair<int,int> pii;
const int MAX=1e5;
const int INF=1e12;
int N,K,Q,res,loc,year,X[MAX],T[MAX],S[MAX],E[MAX],dp[MAX];
signed main()
{
ios_base::sync_with_stdio(false);
/*cin.tie(0);
cout.tie(0);*/
cin>>N>>K>>Q;
for(int A=1;A<=N;A++)
cin>>X[A]>>T[A]>>S[A]>>E[A];
while(Q--)
{
res=0;
cin>>loc>>year;
for(int A=1;A<=K;A++)
dp[A]=INF;
for(int A=1;A<=N;A++)
{
if(S[A]<=year and E[A]>=year)
dp[T[A]]=min(dp[T[A]],abs(X[A]-loc));
}
for(int A=1;A<=K;A++)
res=max(res,dp[A]);
if(res==INF)
res=-1;
cout<<res<<"\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
3 ms |
524 KB |
Output is correct |
5 |
Correct |
4 ms |
524 KB |
Output is correct |
6 |
Correct |
5 ms |
524 KB |
Output is correct |
7 |
Correct |
6 ms |
564 KB |
Output is correct |
8 |
Correct |
4 ms |
564 KB |
Output is correct |
9 |
Correct |
6 ms |
564 KB |
Output is correct |
10 |
Correct |
4 ms |
564 KB |
Output is correct |
11 |
Correct |
4 ms |
700 KB |
Output is correct |
12 |
Correct |
3 ms |
700 KB |
Output is correct |
13 |
Correct |
4 ms |
716 KB |
Output is correct |
14 |
Correct |
3 ms |
728 KB |
Output is correct |
15 |
Correct |
5 ms |
728 KB |
Output is correct |
16 |
Correct |
4 ms |
728 KB |
Output is correct |
17 |
Correct |
4 ms |
728 KB |
Output is correct |
18 |
Correct |
4 ms |
728 KB |
Output is correct |
19 |
Correct |
3 ms |
728 KB |
Output is correct |
20 |
Correct |
4 ms |
728 KB |
Output is correct |
21 |
Correct |
3 ms |
728 KB |
Output is correct |
22 |
Correct |
4 ms |
728 KB |
Output is correct |
23 |
Correct |
4 ms |
728 KB |
Output is correct |
24 |
Correct |
4 ms |
728 KB |
Output is correct |
25 |
Correct |
4 ms |
728 KB |
Output is correct |
26 |
Correct |
3 ms |
728 KB |
Output is correct |
27 |
Correct |
4 ms |
728 KB |
Output is correct |
28 |
Correct |
4 ms |
728 KB |
Output is correct |
29 |
Correct |
5 ms |
728 KB |
Output is correct |
30 |
Correct |
3 ms |
728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
3 ms |
524 KB |
Output is correct |
5 |
Correct |
4 ms |
524 KB |
Output is correct |
6 |
Correct |
5 ms |
524 KB |
Output is correct |
7 |
Correct |
6 ms |
564 KB |
Output is correct |
8 |
Correct |
4 ms |
564 KB |
Output is correct |
9 |
Correct |
6 ms |
564 KB |
Output is correct |
10 |
Correct |
4 ms |
564 KB |
Output is correct |
11 |
Correct |
4 ms |
700 KB |
Output is correct |
12 |
Correct |
3 ms |
700 KB |
Output is correct |
13 |
Correct |
4 ms |
716 KB |
Output is correct |
14 |
Correct |
3 ms |
728 KB |
Output is correct |
15 |
Correct |
5 ms |
728 KB |
Output is correct |
16 |
Correct |
4 ms |
728 KB |
Output is correct |
17 |
Correct |
4 ms |
728 KB |
Output is correct |
18 |
Correct |
4 ms |
728 KB |
Output is correct |
19 |
Correct |
3 ms |
728 KB |
Output is correct |
20 |
Correct |
4 ms |
728 KB |
Output is correct |
21 |
Correct |
3 ms |
728 KB |
Output is correct |
22 |
Correct |
4 ms |
728 KB |
Output is correct |
23 |
Correct |
4 ms |
728 KB |
Output is correct |
24 |
Correct |
4 ms |
728 KB |
Output is correct |
25 |
Correct |
4 ms |
728 KB |
Output is correct |
26 |
Correct |
3 ms |
728 KB |
Output is correct |
27 |
Correct |
4 ms |
728 KB |
Output is correct |
28 |
Correct |
4 ms |
728 KB |
Output is correct |
29 |
Correct |
5 ms |
728 KB |
Output is correct |
30 |
Correct |
3 ms |
728 KB |
Output is correct |
31 |
Execution timed out |
5051 ms |
2924 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
52 ms |
6908 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
51 ms |
7036 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
3 ms |
524 KB |
Output is correct |
5 |
Correct |
4 ms |
524 KB |
Output is correct |
6 |
Correct |
5 ms |
524 KB |
Output is correct |
7 |
Correct |
6 ms |
564 KB |
Output is correct |
8 |
Correct |
4 ms |
564 KB |
Output is correct |
9 |
Correct |
6 ms |
564 KB |
Output is correct |
10 |
Correct |
4 ms |
564 KB |
Output is correct |
11 |
Correct |
4 ms |
700 KB |
Output is correct |
12 |
Correct |
3 ms |
700 KB |
Output is correct |
13 |
Correct |
4 ms |
716 KB |
Output is correct |
14 |
Correct |
3 ms |
728 KB |
Output is correct |
15 |
Correct |
5 ms |
728 KB |
Output is correct |
16 |
Correct |
4 ms |
728 KB |
Output is correct |
17 |
Correct |
4 ms |
728 KB |
Output is correct |
18 |
Correct |
4 ms |
728 KB |
Output is correct |
19 |
Correct |
3 ms |
728 KB |
Output is correct |
20 |
Correct |
4 ms |
728 KB |
Output is correct |
21 |
Correct |
3 ms |
728 KB |
Output is correct |
22 |
Correct |
4 ms |
728 KB |
Output is correct |
23 |
Correct |
4 ms |
728 KB |
Output is correct |
24 |
Correct |
4 ms |
728 KB |
Output is correct |
25 |
Correct |
4 ms |
728 KB |
Output is correct |
26 |
Correct |
3 ms |
728 KB |
Output is correct |
27 |
Correct |
4 ms |
728 KB |
Output is correct |
28 |
Correct |
4 ms |
728 KB |
Output is correct |
29 |
Correct |
5 ms |
728 KB |
Output is correct |
30 |
Correct |
3 ms |
728 KB |
Output is correct |
31 |
Execution timed out |
5051 ms |
2924 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
428 KB |
Output is correct |
4 |
Correct |
3 ms |
524 KB |
Output is correct |
5 |
Correct |
4 ms |
524 KB |
Output is correct |
6 |
Correct |
5 ms |
524 KB |
Output is correct |
7 |
Correct |
6 ms |
564 KB |
Output is correct |
8 |
Correct |
4 ms |
564 KB |
Output is correct |
9 |
Correct |
6 ms |
564 KB |
Output is correct |
10 |
Correct |
4 ms |
564 KB |
Output is correct |
11 |
Correct |
4 ms |
700 KB |
Output is correct |
12 |
Correct |
3 ms |
700 KB |
Output is correct |
13 |
Correct |
4 ms |
716 KB |
Output is correct |
14 |
Correct |
3 ms |
728 KB |
Output is correct |
15 |
Correct |
5 ms |
728 KB |
Output is correct |
16 |
Correct |
4 ms |
728 KB |
Output is correct |
17 |
Correct |
4 ms |
728 KB |
Output is correct |
18 |
Correct |
4 ms |
728 KB |
Output is correct |
19 |
Correct |
3 ms |
728 KB |
Output is correct |
20 |
Correct |
4 ms |
728 KB |
Output is correct |
21 |
Correct |
3 ms |
728 KB |
Output is correct |
22 |
Correct |
4 ms |
728 KB |
Output is correct |
23 |
Correct |
4 ms |
728 KB |
Output is correct |
24 |
Correct |
4 ms |
728 KB |
Output is correct |
25 |
Correct |
4 ms |
728 KB |
Output is correct |
26 |
Correct |
3 ms |
728 KB |
Output is correct |
27 |
Correct |
4 ms |
728 KB |
Output is correct |
28 |
Correct |
4 ms |
728 KB |
Output is correct |
29 |
Correct |
5 ms |
728 KB |
Output is correct |
30 |
Correct |
3 ms |
728 KB |
Output is correct |
31 |
Execution timed out |
5051 ms |
2924 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |