# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
224024 | 2020-04-17T05:11:53 Z | cheeheng | Collecting Stamps 3 (JOI20_ho_t3) | C++14 | 5 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; int X[205]; int T[205]; int main(){ int N, L; scanf("%d%d", &N, &L); X[0] = 0; for(int i = 1; i <= N; i ++){ scanf("%d", &X[i]); } X[N+1] = L; T[0] = 0; for(int i = 1; i <= N; i ++){ scanf("%d", &T[i]); } T[N+1] = 0; // clockwise, then anticlockwise int ans = 0; for(int i = 0; i <= N; i ++){ int temp = 0; long long t_taken = 0; for(int k = 1; k <= i; k ++){ t_taken += X[k]-X[k-1]; if(t_taken <= T[k]){ temp ++; } } t_taken *= 2; for(int j = N; j >= i+1; j --){ t_taken += X[j+1]-X[j]; if(t_taken <= T[j]){ temp ++; } } ans = max(temp, ans); } // anticlockwise, then clockwise for(int i = 0; i <= N; i ++){ int temp = 0; long long t_taken = 0; for(int j = N; j >= i+1; j --){ t_taken += X[j+1]-X[j]; if(t_taken <= T[j]){ temp ++; } } t_taken *= 2; for(int k = 1; k <= i; k ++){ t_taken += X[k]-X[k-1]; if(t_taken <= T[k]){ temp ++; } } ans = max(temp, ans); } printf("%d", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 256 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |