#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>N; FOR(i,N+1) cin>>S[i]; FOR(x,101) dp[0][x]=(x<=S[0])?x+1:(1LL<<60); for(i=1;i<=N;i++) { FOR(j,101) { if(j<=S[i]) { dp[i][j]=dp[i-1][j]+1; for(x=0;x