# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134198 | 2019-07-22T08:15:57 Z | 송준혁(#3232) | Popeala (CEOI16_popeala) | C++14 | 1078 ms | 10400 KB |
#include <bits/stdc++.h> using namespace std; typedef long long LL; typedef pair<int, int> pii; int N, M, K; LL S[20202]; LL D[20202][60]; int P[20202][60], tmp[60]; int main(){ scanf("%d %d %d", &M, &N, &K); for (int i=1; i<=N; i++){ scanf("%d", &S[i]); S[i] += S[i-1]; } for (int i=1; i<=M; i++) for (int j=1; j<=N; j++){ scanf("%1d", &P[j][i]); if (P[j][i] == 0) P[j][i] = j; else P[j][i] = P[j-1][i]; } for (int i=1; i<=N; i++) sort(P[i]+1, P[i]+M+1); memset(D, 1, sizeof D); D[0][0] = 0; for (int i=1; i<=N; i++) for (int j=1; j<=K; j++){ int t=0; vector<int> V; for (int k=0; k<=M; k++) for (int l=0; l<=min(j, 10); l++) V.push_back(P[i][k]+l); V.push_back(i); sort(V.begin(), V.end()); V.erase(unique(V.begin(), V.end()), V.end()); for (int k : V){ if (k == 0) continue; if (k > i) break; while (t < M && P[i][t+1] < k) t++; D[i][j] = min(D[i][j], D[k-1][j-1] + (S[i]-S[k-1]) * t); } } for (int i=1; i<=K; i++) printf("%lld\n", D[N][i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9848 KB | Output is correct |
2 | Correct | 17 ms | 9848 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 265 ms | 10104 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1078 ms | 10400 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 9848 KB | Output is correct |
2 | Correct | 17 ms | 9848 KB | Output is correct |
3 | Incorrect | 265 ms | 10104 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |