Submission #310073

# Submission time Handle Problem Language Result Execution time Memory
310073 2020-10-05T14:53:13 Z jungsnow Popeala (CEOI16_popeala) C++14
26 / 100
1577 ms 47096 KB
#include<bits/stdc++.h>

using namespace std;

int n, s, t, c[4001];
int cn[4001][4001], sum[4001];
int dp[4001][55];
bool a[55][4001];

int main() {
//    freopen("popeala.inp", "r", stdin);
//    freopen("popeala.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n>>t>>s;
    for (int i = 1; i <= t; ++i) cin>>c[i], sum[i] = c[i] + sum[i - 1];
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= t; ++j) {
            char x; cin>>x;
            a[i][j] = x - '0';
        }
    }
    int has[55];
    for (int r = 1; r <= t; ++r) {
        memset(has, 0, sizeof has);
        for (int l = r; l >= 1; --l) {
            for (int i = 1; i <= n; ++i) {
                has[i] += a[i][l];
                cn[l][r] += (has[i] == r - l + 1);
            }
        }
    }
    memset(dp, 0x3f, sizeof dp);
    dp[0][0] = 0;
    for (int r = 1; r <= t; ++r) {
        for (int l = 1; l <= r; ++l) {
            for (int k = 1; k <= s; ++k) {
                dp[r][k] = min(dp[r][k],
                    cn[l][r] * (sum[r] - sum[l - 1]) + dp[l - 1][k - 1]);
            }
        }
    }
    for (int k = 1; k <= s; ++k) cout<<dp[t][k]<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1280 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 3968 KB Output is correct
2 Correct 20 ms 4096 KB Output is correct
3 Correct 20 ms 3968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 430 ms 19832 KB Output is correct
2 Correct 849 ms 31352 KB Output is correct
3 Correct 1577 ms 47096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1280 KB Output is correct
2 Correct 1 ms 1536 KB Output is correct
3 Correct 20 ms 3968 KB Output is correct
4 Correct 20 ms 4096 KB Output is correct
5 Correct 20 ms 3968 KB Output is correct
6 Correct 430 ms 19832 KB Output is correct
7 Correct 849 ms 31352 KB Output is correct
8 Correct 1577 ms 47096 KB Output is correct
9 Incorrect 73 ms 7548 KB Output isn't correct
10 Halted 0 ms 0 KB -