Submission #908715

#TimeUsernameProblemLanguageResultExecution timeMemory
908715vjudge1Popeala (CEOI16_popeala)C++17
8 / 100
6 ms6232 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int T = 2e4 + 7; const int N = 50; const int INF = 2e9; int n, t, s; int points[T], task[T], sum[N][T]; int pref[T], dp[N][T]; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...