# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1032650 | 2024-07-24T05:13:17 Z | 김은성(#10965) | Popeala (CEOI16_popeala) | C++17 | 80 ms | 1672 KB |
#include <bits/stdc++.h> using namespace std; int p[20009], dp[52][20009]; int n, r[52][20009]; char res[20009]; int solved(int s, int e){ int ans = 0, i; for(i=1; i<=n; i++){ if(r[i][e] - r[i][s-1] == e-s+1) ans++; } return ans; } void go(int idx, int l, int r, int pl, int pr){ if(l>r) return; int mid = (l+r)/2, opt, k, temp = 2147000000; for(k=pl; k<=pr && k<mid; k++){ int x = dp[idx-1][k] + solved(k+1, mid) * (p[mid] - p[k]); if(x < temp){ temp = x; opt = k; } } dp[idx][mid] = temp; go(idx, l, mid-1, pl, min(opt+5, pr)); go(idx, mid+1, r, max(opt-5, pl), pr); } int main(){ int t, s, i, j; 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++){ scanf(" %s", res+1); for(j=1; j<=t; j++) r[i][j] = r[i][j-1] + res[j] - '0'; } for(i=1; i<=t; i++) dp[1][i] = solved(1, i) * p[i]; for(i=2; i<=s; i++){ go(i, i, t, i-1, t-1); } for(i=1;i <=s; i++) printf("%d\n", dp[i][t]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 828 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 80 ms | 1672 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 604 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |