# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
154379 | 2019-09-21T14:14:00 Z | arnold518 | Popeala (CEOI16_popeala) | C++14 | 2000 ms | 9080 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 50; const int MAXT = 20000; const ll INF = 1e15; int N, T, S, P[MAXT+10], R[MAXN+10][MAXT+10]; vector<int> V[MAXT+10]; int cnt[MAXN+10]; ll dp[MAXN+10][MAXT+10]; int main() { int i, j, k, p; scanf("%d%d%d", &N, &T, &S); for(i=1; i<=T; i++) scanf("%d", &P[i]), P[i]+=P[i-1]; for(i=1; i<=N; i++) for(j=1; j<=T; j++) scanf("%1d", &R[i][j]); for(i=1; i<=T; i++) { for(j=1; j<=N; j++) if(R[j][i]==0) cnt[j]=i; for(j=1; j<=N; j++) V[i].push_back(cnt[j]); V[i].push_back(i); V[i].push_back(0); sort(V[i].begin(), V[i].end()); //for(j=0; j<=N+1; j++) printf("%d ", V[i][j]); printf("\n"); } for(i=0; i<=S; i++) for(j=0; j<=T; j++) dp[i][j]=INF; dp[0][0]=0; for(i=1; i<=S; i++) { for(j=1; j<=T; j++) { for(k=0; k<=N; k++) { ll now=INF; for(p=V[j][k]; p<V[j][k+1]; p++) now=min(now, dp[i-1][p]+k*P[j]-k*P[p]); dp[i][j]=min(dp[i][j], now); } } } for(i=1; i<=S; i++) printf("%lld\n", dp[i][T]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 888 KB | Output is correct |
2 | Correct | 3 ms | 1016 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 1656 KB | Output is correct |
2 | Correct | 21 ms | 1656 KB | Output is correct |
3 | Correct | 22 ms | 1728 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 211 ms | 3256 KB | Output is correct |
2 | Correct | 370 ms | 4016 KB | Output is correct |
3 | Correct | 627 ms | 4984 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 888 KB | Output is correct |
2 | Correct | 3 ms | 1016 KB | Output is correct |
3 | Correct | 22 ms | 1656 KB | Output is correct |
4 | Correct | 21 ms | 1656 KB | Output is correct |
5 | Correct | 22 ms | 1728 KB | Output is correct |
6 | Correct | 211 ms | 3256 KB | Output is correct |
7 | Correct | 370 ms | 4016 KB | Output is correct |
8 | Correct | 627 ms | 4984 KB | Output is correct |
9 | Correct | 1561 ms | 7232 KB | Output is correct |
10 | Execution timed out | 2074 ms | 9080 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |