Submission #734816

# Submission time Handle Problem Language Result Execution time Memory
734816 2023-05-03T06:13:58 Z keisuke6 New Home (APIO18_new_home) C++14
5 / 100
5000 ms 5892 KB
#pragma GCC target("avx512f")
#include <bits/stdc++.h>
using namespace std;

int main(){
  int N,K,Q;
  cin>>N>>K>>Q;
  if(N <= 400 && Q <= 400){
    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,2e9);
    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] == 2e9 ? -1 : S[0])<<endl;
  }
    return 0;
  }
  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,2e9);
    for(int i=0;i<N;i++){
      if(A[i] > t || B[i] < t) continue;
      int tt = X[i]-x;
      if(tt < 0) tt = -tt;
      //if(S[T[i]] > tt) S[T[i]] = tt;
    }
    sort(S.rbegin(),S.rend());
    cout<<(S[0] == 2e9 ? -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 0 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 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 2 ms 212 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 212 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 5 ms 212 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 4 ms 212 KB Output is correct
24 Correct 3 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 212 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 0 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 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 2 ms 212 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 212 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 5 ms 212 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 4 ms 212 KB Output is correct
24 Correct 3 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 212 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Incorrect 323 ms 1356 KB Output isn't correct
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5084 ms 5368 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5029 ms 5892 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 0 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 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 2 ms 212 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 212 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 5 ms 212 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 4 ms 212 KB Output is correct
24 Correct 3 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 212 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Incorrect 323 ms 1356 KB Output isn't correct
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 0 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 212 KB Output is correct
8 Correct 4 ms 212 KB Output is correct
9 Correct 6 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 2 ms 212 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 212 KB Output is correct
17 Correct 3 ms 212 KB Output is correct
18 Correct 4 ms 212 KB Output is correct
19 Correct 5 ms 212 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 4 ms 212 KB Output is correct
24 Correct 3 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 212 KB Output is correct
30 Correct 2 ms 212 KB Output is correct
31 Incorrect 323 ms 1356 KB Output isn't correct
32 Halted 0 ms 0 KB -