Submission #224024

#TimeUsernameProblemLanguageResultExecution timeMemory
224024cheehengCollecting Stamps 3 (JOI20_ho_t3)C++14
0 / 100
5 ms384 KiB
#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 (stderr)

ho_t3.cpp: In function 'int main()':
ho_t3.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &L);
     ~~~~~^~~~~~~~~~~~~~~~
ho_t3.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &X[i]);
         ~~~~~^~~~~~~~~~~~~
ho_t3.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &T[i]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...