Submission #734797

# Submission time Handle Problem Language Result Execution time Memory
734797 2023-05-03T05:59:30 Z keisuke6 New Home (APIO18_new_home) C++14
5 / 100
5000 ms 18536 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int N,K,Q;
  cin>>N>>K>>Q;
  vector<int> X(N),T(N),A(N),B(N);
  for(int i=0;i<N;i++){
    cin>>X[i]>>T[i]>>A[i]>>B[i];
    T[i]--;
  }
  while(Q--){
    int x,t;
    cin>>x>>t;
    vector<int> S(K,1e18);
    for(int i=0;i<N;i++){
      if(A[i] > t || B[i] < t) continue;
      S[T[i]] = min(S[T[i]],abs(X[i]-x));
    }
    sort(S.rbegin(),S.rend());
    cout<<(S[0] == 1e18 ? -1 : S[0])<<endl;
  }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 5 ms 312 KB Output is correct
8 Correct 4 ms 312 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 3 ms 312 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 3 ms 312 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 4 ms 212 KB Output is correct
16 Correct 5 ms 312 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 6 ms 312 KB Output is correct
20 Correct 3 ms 212 KB Output is correct
21 Correct 3 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 5 ms 212 KB Output is correct
24 Correct 4 ms 212 KB Output is correct
25 Correct 3 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 2 ms 212 KB Output is correct
29 Correct 2 ms 312 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 5 ms 312 KB Output is correct
8 Correct 4 ms 312 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 3 ms 312 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 3 ms 312 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 4 ms 212 KB Output is correct
16 Correct 5 ms 312 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 6 ms 312 KB Output is correct
20 Correct 3 ms 212 KB Output is correct
21 Correct 3 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 5 ms 212 KB Output is correct
24 Correct 4 ms 212 KB Output is correct
25 Correct 3 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 2 ms 212 KB Output is correct
29 Correct 2 ms 312 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Execution timed out 5053 ms 4984 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5026 ms 18536 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5019 ms 17544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 5 ms 312 KB Output is correct
8 Correct 4 ms 312 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 3 ms 312 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 3 ms 312 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 4 ms 212 KB Output is correct
16 Correct 5 ms 312 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 6 ms 312 KB Output is correct
20 Correct 3 ms 212 KB Output is correct
21 Correct 3 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 5 ms 212 KB Output is correct
24 Correct 4 ms 212 KB Output is correct
25 Correct 3 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 2 ms 212 KB Output is correct
29 Correct 2 ms 312 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Execution timed out 5053 ms 4984 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 5 ms 312 KB Output is correct
8 Correct 4 ms 312 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 3 ms 312 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 3 ms 312 KB Output is correct
14 Correct 2 ms 212 KB Output is correct
15 Correct 4 ms 212 KB Output is correct
16 Correct 5 ms 312 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 6 ms 312 KB Output is correct
20 Correct 3 ms 212 KB Output is correct
21 Correct 3 ms 212 KB Output is correct
22 Correct 7 ms 212 KB Output is correct
23 Correct 5 ms 212 KB Output is correct
24 Correct 4 ms 212 KB Output is correct
25 Correct 3 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 2 ms 212 KB Output is correct
28 Correct 2 ms 212 KB Output is correct
29 Correct 2 ms 312 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Execution timed out 5053 ms 4984 KB Time limit exceeded
32 Halted 0 ms 0 KB -