Submission #908718

# Submission time Handle Problem Language Result Execution time Memory
908718 2024-01-16T17:34:45 Z vjudge1 Popeala (CEOI16_popeala) C++17
17 / 100
2000 ms 3164 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
const int T = 2e4 + 7;
const int N = 50 + 7;
const int INF = 2e9;
int n, t, s;
int points[T], task[T], sum[N][T];
int pref[T], dp[T][N];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> t >> s;
    for (int i = 1; i <= t; ++i) cin >> points[i];
    for (int i = 1; i <= t; ++i) pref[i] = pref[i - 1] + points[i];
    for (int i = 1; i <= n; ++i) {
        string s;
        cin >> s;
        for (int j = 0; j < t; ++j) sum[i][j + 1] = sum[i][j] + s[j] - '0';
    }
    for (int g = 0; g <= s; ++g) for (int i = 0; i <= t; ++i) dp[i][g] = INF;
    dp[0][0] = 0;
    for (int g = 1; g <= s; ++g) {
        for (int i = 1; i <= t; ++i) {
            for (int j = 1; j <= i; ++j) {
                int score = 0;
                for (int guy = 1; guy <= n; ++guy) {
                    if (sum[guy][i] - sum[guy][j - 1] == i - j + 1) {
                        score += pref[i] - pref[j - 1];
                    }
                }
                dp[i][g] = min(dp[i][g], dp[j - 1][g - 1] + score);
            }
        }
    }
    for (int i = 1; i <= s; ++i) cout << dp[t][i] << "\n";
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 287 ms 868 KB Output is correct
2 Correct 285 ms 860 KB Output is correct
3 Correct 299 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 3164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 856 KB Output is correct
3 Correct 287 ms 868 KB Output is correct
4 Correct 285 ms 860 KB Output is correct
5 Correct 299 ms 856 KB Output is correct
6 Execution timed out 2037 ms 3164 KB Time limit exceeded
7 Halted 0 ms 0 KB -