# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170778 | 2019-12-26T10:44:24 Z | juggernaut | K blocks (IZhO14_blocks) | C++14 | 3 ms | 760 KB |
//Just try and the idea will come! #include<bits/stdc++.h> #define int long long int using namespace std; int n,k,i,a[101],dp[101][101],j,l,sp[101][7],logs[101]; int get(int l,int r){ int len=logs[r-l+1]; return max(sp[l][len],sp[r-(1ll<<len)+1][len]); } void calc(int k,int n){ dp[n][k]=1e15; for(int i=k;i<=n;i++)dp[n][k]=min(dp[n][k],dp[i-1][k-1]+get(i,n)); } main(){ for(i=2;i<101;i++)logs[i]=logs[i/2]+1; scanf("%lld%lld",&n,&k); for(i=1;i<=n;i++)scanf("%lld",&a[i]),dp[i][1]=max(dp[i-1][1],a[i]),sp[i][0]=a[i]; for(j=1;j<7;j++) for(i=1;i+(1ll<<j)-1<=n;i++)sp[i][j]=max(sp[i][j-1],sp[i+(1ll<<(j-1))][j-1]); for(j=2;j<=k;j++) for(i=j;i<=n;i++)calc(j,i); cout<<dp[n][k]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 396 KB | Output is correct |
2 | Correct | 2 ms | 252 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 252 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 396 KB | Output is correct |
13 | Correct | 2 ms | 504 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 404 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 396 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 376 KB | Output is correct |
7 | Correct | 2 ms | 256 KB | Output is correct |
8 | Correct | 2 ms | 296 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 2 ms | 396 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 380 KB | Output is correct |
15 | Correct | 2 ms | 292 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 2 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 348 KB | Output is correct |
19 | Correct | 2 ms | 348 KB | Output is correct |
20 | Correct | 2 ms | 296 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Correct | 2 ms | 256 KB | Output is correct |
3 | Correct | 2 ms | 256 KB | Output is correct |
4 | Correct | 2 ms | 360 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 376 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 376 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 368 KB | Output is correct |
14 | Correct | 2 ms | 476 KB | Output is correct |
15 | Correct | 3 ms | 376 KB | Output is correct |
16 | Correct | 3 ms | 376 KB | Output is correct |
17 | Correct | 3 ms | 376 KB | Output is correct |
18 | Correct | 2 ms | 376 KB | Output is correct |
19 | Correct | 3 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |