# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
402250 | 2021-05-11T13:02:06 Z | A_D | New Home (APIO18_new_home) | C++14 | 3 ms | 460 KB |
#include <bits/stdc++.h> #define int long long #define ii pair<int,int> #define F first #define S second #define du long double using namespace std; const int N=410; int x[N]; int a[N]; int b[N]; int t[N]; void solve() { int n,k,q; cin>>n>>k>>q; for(int i=1;i<=n;i++){ cin>>x[i]; cin>>t[i]; cin>>a[i]; cin>>b[i]; t[i]--; } while(q--){ int l,y; scanf("%lld",&l); scanf("%lld",&y); vector<int> vec(k,1e8+1); for(int i=1;i<=n;i++){ if(a[i]<=y&&y<=b[i]){ vec[t[i]]=min(vec[t[i]],abs(x[i]-l)); } } int ans=0,bo=0; for(auto x:vec){ if(x==1e8+1)bo=1; ans=max(ans,x); } if(bo)ans=-1; cout<<ans<<endl; } } main() { int t=1; // cin>>t; while(t--)solve(); } /* 4 2 4 3 1 1 10 9 2 2 4 7 2 5 7 4 1 8 10 5 3 5 6 5 9 1 10 2 1 3 1 1 1 4 1 1 2 6 1 3 1 5 1 7 1 1 1 100000000 1 1 1 1 1 */
Compilation message
# | Verdict | Execution time | Memory | 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 | 204 KB | Output is correct |
6 | Correct | 3 ms | 332 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 | 332 KB | Output is correct |
10 | Correct | 3 ms | 204 KB | Output is correct |
11 | Correct | 3 ms | 204 KB | Output is correct |
12 | Correct | 2 ms | 204 KB | Output is correct |
13 | Correct | 2 ms | 204 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 | 3 ms | 204 KB | Output is correct |
22 | Correct | 3 ms | 204 KB | Output is correct |
23 | Correct | 3 ms | 300 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 | 2 ms | 204 KB | Output is correct |
29 | Correct | 2 ms | 204 KB | Output is correct |
30 | Correct | 2 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | 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 | 204 KB | Output is correct |
6 | Correct | 3 ms | 332 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 | 332 KB | Output is correct |
10 | Correct | 3 ms | 204 KB | Output is correct |
11 | Correct | 3 ms | 204 KB | Output is correct |
12 | Correct | 2 ms | 204 KB | Output is correct |
13 | Correct | 2 ms | 204 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 | 3 ms | 204 KB | Output is correct |
22 | Correct | 3 ms | 204 KB | Output is correct |
23 | Correct | 3 ms | 300 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 | 2 ms | 204 KB | Output is correct |
29 | Correct | 2 ms | 204 KB | Output is correct |
30 | Correct | 2 ms | 204 KB | Output is correct |
31 | Runtime error | 2 ms | 460 KB | Execution killed with signal 11 |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 460 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | 204 KB | Output is correct |
6 | Correct | 3 ms | 332 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 | 332 KB | Output is correct |
10 | Correct | 3 ms | 204 KB | Output is correct |
11 | Correct | 3 ms | 204 KB | Output is correct |
12 | Correct | 2 ms | 204 KB | Output is correct |
13 | Correct | 2 ms | 204 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 | 3 ms | 204 KB | Output is correct |
22 | Correct | 3 ms | 204 KB | Output is correct |
23 | Correct | 3 ms | 300 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 | 2 ms | 204 KB | Output is correct |
29 | Correct | 2 ms | 204 KB | Output is correct |
30 | Correct | 2 ms | 204 KB | Output is correct |
31 | Runtime error | 2 ms | 460 KB | Execution killed with signal 11 |
32 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | 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 | 204 KB | Output is correct |
6 | Correct | 3 ms | 332 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 | 332 KB | Output is correct |
10 | Correct | 3 ms | 204 KB | Output is correct |
11 | Correct | 3 ms | 204 KB | Output is correct |
12 | Correct | 2 ms | 204 KB | Output is correct |
13 | Correct | 2 ms | 204 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 | 3 ms | 204 KB | Output is correct |
22 | Correct | 3 ms | 204 KB | Output is correct |
23 | Correct | 3 ms | 300 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 | 2 ms | 204 KB | Output is correct |
29 | Correct | 2 ms | 204 KB | Output is correct |
30 | Correct | 2 ms | 204 KB | Output is correct |
31 | Runtime error | 2 ms | 460 KB | Execution killed with signal 11 |
32 | Halted | 0 ms | 0 KB | - |