Submission #750715

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7507152023-05-30 07:57:30Sami_MassahCollecting Stamps 3 (JOI20_ho_t3)C++17
0 / 100
39 ms74884 KiB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200 + 12, inf = 1e9 + 12;
int n, L, dist[maxn], t[maxn], dp[maxn][maxn][maxn][2];
int get_dist(int a, int b){
if(a == n - 1 && b == 0)
return L - dist[a];
return abs(dist[a] - dist[b]);
}
int find_ans(int a, int b, int c, int d){
if(c < 0)
return inf;
if(dp[a][b][c][d] != -1)
return dp[a][b][c][d];
dp[a][b][c][d] = inf;
//cout << a << ' ' << b << ' ' << c << ' ' << d << endl;
if(d == 0){
if(a != 0){
dp[a][b][c][d] = min(dp[a][b][c][d], find_ans((a + 1) % n, b, c, d) + get_dist(a, a + 1));
int x = find_ans((a + 1) % n, b, c - 1, d) + get_dist(a, a + 1);
if(x <= t[a])
dp[a][b][c][d] = min(dp[a][b][c][d], x);
}
if(a != 0){
dp[a][b][c][d] = min(dp[a][b][c][d], find_ans((a + 1) % n, b, c, d ^ 1) + L - dist[a] + dist[b]);
int x = find_ans((a + 1) % n, b, c - 1, d ^ 1) + L - dist[a] + dist[b];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

ho_t3.cpp: In function 'int _Z8find_ansiiii.part.0(int, int, int, int)':
ho_t3.cpp:10:26: warning: array subscript -1 is below array bounds of 'int [212]' [-Warray-bounds]
   10 |         return L - dist[a];
      |                    ~~~~~~^
ho_t3.cpp:7:11: note: while referencing 'dist'
    7 | int n, L, dist[maxn], t[maxn], dp[maxn][maxn][maxn][2];
      |           ^~~~
ho_t3.cpp:10:26: warning: array subscript -1 is below array bounds of 'int [212]' [-Warray-bounds]
   10 |         return L - dist[a];
      |                    ~~~~~~^
ho_t3.cpp:7:11: note: while referencing 'dist'
    7 | int n, L, dist[maxn], t[maxn], dp[maxn][maxn][maxn][2];
      |           ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...