Submission #537040

# Submission time Handle Problem Language Result Execution time Memory
537040 2022-03-14T09:59:13 Z siewjh Popeala (CEOI16_popeala) C++17
17 / 100
2000 ms 724 KB
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int ppl, cases, grp; cin >> ppl >> cases >> grp;
    vector<int> pts(cases + 1);
    for (int i = 1; i <= cases; i++) cin >> pts[i];
    vector<vector<bool>> ac(ppl, vector<bool>(cases + 1));
    for (int i = 0; i < ppl; i++){
        string str; cin >> str;
        for (int j = 1; j <= cases; j++) ac[i][j] = (str[j - 1] == '1');
    }
    vector<vector<int>> dp(grp + 1, vector<int>(cases + 1, inf));
    dp[0][0] = 0;
    for (int i = 1; i <= grp; i++)
        for (int j = 1; j <= cases; j++){
            vector<bool> ok(ppl, 1);
            int ttp = 0;
            for (int k = j; k >= i; k--){
                int cnt = 0;
                for (int l = 0; l < ppl; l++) {
                    ok[l] = ok[l] & ac[l][k];
                    cnt += ok[l];
                }
                ttp += pts[k];
                dp[i][j] = min(dp[i][j], dp[i - 1][k - 1] + cnt * ttp);
            }
        }
    for (int i = 1; i <= grp; i++) cout << dp[i][cases] << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 913 ms 420 KB Output is correct
2 Correct 871 ms 408 KB Output is correct
3 Correct 922 ms 412 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2077 ms 724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 913 ms 420 KB Output is correct
4 Correct 871 ms 408 KB Output is correct
5 Correct 922 ms 412 KB Output is correct
6 Execution timed out 2077 ms 724 KB Time limit exceeded
7 Halted 0 ms 0 KB -