# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
744354 |
2023-05-18T13:33:05 Z |
Abito |
New Home (APIO18_new_home) |
C++17 |
|
5000 ms |
21656 KB |
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define ep insert
#define pow pwr
#define sqrt sqrtt
using namespace std;
const int N=3e5+5;
int n,k,q;
vector<pair<int,pair<int,int>>> adj[N];
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n>>k>>q;
for (int i=1;i<=n;i++){
int x,y,z,w;
cin>>x>>y>>z>>w;
adj[y].pb({x,{z,w}});
}
while (q--){
int x,y;
cin>>x>>y;
int ans=INT_MIN;
for (int i=1;i<=k;i++){
bool ok=false;
int ansx=INT_MAX;
for (auto u:adj[i]){
if (y>=u.S.F && y<=u.S.S){
ok=true;
ansx=min(ansx,abs(x-u.F));
}
}
if (ok){
ans=max(ans,ansx);
continue;
}
ans=-1;
break;
}cout<<ans<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7252 KB |
Output is correct |
2 |
Correct |
5 ms |
7368 KB |
Output is correct |
3 |
Correct |
5 ms |
7368 KB |
Output is correct |
4 |
Correct |
4 ms |
7252 KB |
Output is correct |
5 |
Correct |
5 ms |
7380 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
4 ms |
7380 KB |
Output is correct |
8 |
Correct |
5 ms |
7388 KB |
Output is correct |
9 |
Correct |
5 ms |
7380 KB |
Output is correct |
10 |
Correct |
5 ms |
7380 KB |
Output is correct |
11 |
Correct |
4 ms |
7380 KB |
Output is correct |
12 |
Correct |
4 ms |
7380 KB |
Output is correct |
13 |
Correct |
4 ms |
7380 KB |
Output is correct |
14 |
Correct |
5 ms |
7284 KB |
Output is correct |
15 |
Correct |
4 ms |
7380 KB |
Output is correct |
16 |
Correct |
5 ms |
7380 KB |
Output is correct |
17 |
Correct |
5 ms |
7380 KB |
Output is correct |
18 |
Correct |
5 ms |
7380 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
4 ms |
7380 KB |
Output is correct |
21 |
Correct |
5 ms |
7380 KB |
Output is correct |
22 |
Correct |
5 ms |
7380 KB |
Output is correct |
23 |
Correct |
6 ms |
7384 KB |
Output is correct |
24 |
Correct |
5 ms |
7376 KB |
Output is correct |
25 |
Correct |
6 ms |
7372 KB |
Output is correct |
26 |
Correct |
4 ms |
7380 KB |
Output is correct |
27 |
Correct |
5 ms |
7380 KB |
Output is correct |
28 |
Correct |
5 ms |
7380 KB |
Output is correct |
29 |
Correct |
5 ms |
7380 KB |
Output is correct |
30 |
Correct |
4 ms |
7380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7252 KB |
Output is correct |
2 |
Correct |
5 ms |
7368 KB |
Output is correct |
3 |
Correct |
5 ms |
7368 KB |
Output is correct |
4 |
Correct |
4 ms |
7252 KB |
Output is correct |
5 |
Correct |
5 ms |
7380 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
4 ms |
7380 KB |
Output is correct |
8 |
Correct |
5 ms |
7388 KB |
Output is correct |
9 |
Correct |
5 ms |
7380 KB |
Output is correct |
10 |
Correct |
5 ms |
7380 KB |
Output is correct |
11 |
Correct |
4 ms |
7380 KB |
Output is correct |
12 |
Correct |
4 ms |
7380 KB |
Output is correct |
13 |
Correct |
4 ms |
7380 KB |
Output is correct |
14 |
Correct |
5 ms |
7284 KB |
Output is correct |
15 |
Correct |
4 ms |
7380 KB |
Output is correct |
16 |
Correct |
5 ms |
7380 KB |
Output is correct |
17 |
Correct |
5 ms |
7380 KB |
Output is correct |
18 |
Correct |
5 ms |
7380 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
4 ms |
7380 KB |
Output is correct |
21 |
Correct |
5 ms |
7380 KB |
Output is correct |
22 |
Correct |
5 ms |
7380 KB |
Output is correct |
23 |
Correct |
6 ms |
7384 KB |
Output is correct |
24 |
Correct |
5 ms |
7376 KB |
Output is correct |
25 |
Correct |
6 ms |
7372 KB |
Output is correct |
26 |
Correct |
4 ms |
7380 KB |
Output is correct |
27 |
Correct |
5 ms |
7380 KB |
Output is correct |
28 |
Correct |
5 ms |
7380 KB |
Output is correct |
29 |
Correct |
5 ms |
7380 KB |
Output is correct |
30 |
Correct |
4 ms |
7380 KB |
Output is correct |
31 |
Execution timed out |
5023 ms |
11404 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5020 ms |
21656 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
5005 ms |
20488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7252 KB |
Output is correct |
2 |
Correct |
5 ms |
7368 KB |
Output is correct |
3 |
Correct |
5 ms |
7368 KB |
Output is correct |
4 |
Correct |
4 ms |
7252 KB |
Output is correct |
5 |
Correct |
5 ms |
7380 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
4 ms |
7380 KB |
Output is correct |
8 |
Correct |
5 ms |
7388 KB |
Output is correct |
9 |
Correct |
5 ms |
7380 KB |
Output is correct |
10 |
Correct |
5 ms |
7380 KB |
Output is correct |
11 |
Correct |
4 ms |
7380 KB |
Output is correct |
12 |
Correct |
4 ms |
7380 KB |
Output is correct |
13 |
Correct |
4 ms |
7380 KB |
Output is correct |
14 |
Correct |
5 ms |
7284 KB |
Output is correct |
15 |
Correct |
4 ms |
7380 KB |
Output is correct |
16 |
Correct |
5 ms |
7380 KB |
Output is correct |
17 |
Correct |
5 ms |
7380 KB |
Output is correct |
18 |
Correct |
5 ms |
7380 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
4 ms |
7380 KB |
Output is correct |
21 |
Correct |
5 ms |
7380 KB |
Output is correct |
22 |
Correct |
5 ms |
7380 KB |
Output is correct |
23 |
Correct |
6 ms |
7384 KB |
Output is correct |
24 |
Correct |
5 ms |
7376 KB |
Output is correct |
25 |
Correct |
6 ms |
7372 KB |
Output is correct |
26 |
Correct |
4 ms |
7380 KB |
Output is correct |
27 |
Correct |
5 ms |
7380 KB |
Output is correct |
28 |
Correct |
5 ms |
7380 KB |
Output is correct |
29 |
Correct |
5 ms |
7380 KB |
Output is correct |
30 |
Correct |
4 ms |
7380 KB |
Output is correct |
31 |
Execution timed out |
5023 ms |
11404 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
7252 KB |
Output is correct |
2 |
Correct |
5 ms |
7368 KB |
Output is correct |
3 |
Correct |
5 ms |
7368 KB |
Output is correct |
4 |
Correct |
4 ms |
7252 KB |
Output is correct |
5 |
Correct |
5 ms |
7380 KB |
Output is correct |
6 |
Correct |
5 ms |
7332 KB |
Output is correct |
7 |
Correct |
4 ms |
7380 KB |
Output is correct |
8 |
Correct |
5 ms |
7388 KB |
Output is correct |
9 |
Correct |
5 ms |
7380 KB |
Output is correct |
10 |
Correct |
5 ms |
7380 KB |
Output is correct |
11 |
Correct |
4 ms |
7380 KB |
Output is correct |
12 |
Correct |
4 ms |
7380 KB |
Output is correct |
13 |
Correct |
4 ms |
7380 KB |
Output is correct |
14 |
Correct |
5 ms |
7284 KB |
Output is correct |
15 |
Correct |
4 ms |
7380 KB |
Output is correct |
16 |
Correct |
5 ms |
7380 KB |
Output is correct |
17 |
Correct |
5 ms |
7380 KB |
Output is correct |
18 |
Correct |
5 ms |
7380 KB |
Output is correct |
19 |
Correct |
6 ms |
7380 KB |
Output is correct |
20 |
Correct |
4 ms |
7380 KB |
Output is correct |
21 |
Correct |
5 ms |
7380 KB |
Output is correct |
22 |
Correct |
5 ms |
7380 KB |
Output is correct |
23 |
Correct |
6 ms |
7384 KB |
Output is correct |
24 |
Correct |
5 ms |
7376 KB |
Output is correct |
25 |
Correct |
6 ms |
7372 KB |
Output is correct |
26 |
Correct |
4 ms |
7380 KB |
Output is correct |
27 |
Correct |
5 ms |
7380 KB |
Output is correct |
28 |
Correct |
5 ms |
7380 KB |
Output is correct |
29 |
Correct |
5 ms |
7380 KB |
Output is correct |
30 |
Correct |
4 ms |
7380 KB |
Output is correct |
31 |
Execution timed out |
5023 ms |
11404 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |