제출 #224124

#제출 시각아이디문제언어결과실행 시간메모리
224124dantoh000Collecting Stamps 3 (JOI20_ho_t3)C++14
0 / 100
5 ms384 KiB
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; const int INF = 2000000000; int n,l; int x[205], t[205]; int w1[205], w2[205]; int mem[205][205][205][2]; int dp(int i, int j, int t, int k){ ///[i,j], t left, dir k if (t < 0) return -INF; if (t == 0) return 0; if (mem[i][j][t][k] != -1) return mem[i][j][t][k]; int time = x[i-1] + l-x[j+1]; int res = 0; if (k == 0){ res = max(res,max(dp(i+1,j,t-(x[i+1]-x[i]),0)+1, dp(i,j-1,t-time,1))+1); } else{ res = max(res,max(dp(i,j-1,t-(x[j+1]-x[j]),1)+1, dp(i+1,j,t-time,0))+1); } return mem[i][j][t][k] = res; } int main(){ scanf("%d%d",&n,&l); for (int i = 1; i <= n; i++){ scanf("%d",&x[i]); } x[n+1] = l; for (int i = 1; i <= n; i++){ scanf("%d",&t[i]); } int ans = 0; for (int i = 1; i <= n; i++){ for (int j = n; j >= i; j--){ int ct = 0; int T = 0; for (int k = 1; k <= i; k++){ T += x[k]-x[k-1]; if (T <= t[k]) ct++; } T *= 2; for (int k = n; k >= j; k--){ T += x[k+1]-x[k]; if (T <= t[k]) ct++; } ans = max(ans,ct); } } for (int i = 1; i <= n; i++){ for (int j = n; j >= i; j--){ int ct = 0; int T = 0; for (int k = n; k >= j; k--){ T += x[k+1]-x[k]; if (T <= t[k]) ct++; } T *= 2; for (int k = 1; k <= i; k++){ T += x[k]-x[k-1]; if (T <= t[k]) ct++; } ans = max(ans,ct); } } printf("%d ",ans); }

컴파일 시 표준 에러 (stderr) 메시지

ho_t3.cpp: In function 'int main()':
ho_t3.cpp:25: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:27: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:31: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...