Submission #1099398

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10993982024-10-11 09:13:44alexander707070Tortoise (CEOI21_tortoise)C++14
0 / 100
1 ms604 KiB
#include<bits/stdc++.h>
#define MAXN 307
using namespace std;
int n,a[MAXN];
int dist[MAXN],last,sum;
int dp[MAXN][2*MAXN][2];
bool li[MAXN][2*MAXN][2];
int ff(int pos,int tim,int c){
if(tim>2*n or pos>n)return 0;
if(li[pos][tim][c])return dp[pos][tim][c];
li[pos][tim][c]=true;
if(a[pos]>0){
if(tim<=2*(pos-1))dp[pos][tim][c]=max(dp[pos][tim][c],ff(pos,tim,1));
for(int s=0;tim+s*2*dist[pos]<=2*(pos-1) and s+1<=a[pos];s++){
if(s+1==a[pos] or tim+(s+1)*2*dist[pos]>2*(pos-1)) dp[pos][tim][c]=max(dp[pos][tim][c],ff(pos+1,tim+(s+1)*2*dist[pos]+1,0)+s+1);
else dp[pos][tim][c]=max(dp[pos][tim][c],ff(pos+1,tim+(s+1)*2*dist[pos]+1,1)+s+1);
}
}
if(c==1 and a[pos]==-1)dp[pos][tim][c]=max(dp[pos][tim][c],ff(pos,tim,0)+1);
if(pos<n)dp[pos][tim][c]=max(dp[pos][tim][c],ff(pos+1,tim+1,c));
return dp[pos][tim][c];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...