Submission #537014

#TimeUsernameProblemLanguageResultExecution timeMemory
537014squiddyPopeala (CEOI16_popeala)C++14
8 / 100
2088 ms54872 KiB
#include <bits/stdc++.h> #define fast_input ios_base::sync_with_stdio(0); cin.tie(0); using namespace std; #define ii pair<int, int> #define iii pair<int, ii> #define ll long long #define ull unsigned long long #define pq priority_queue #define FOR(v, s, e) for (int v = s; v < e; v++) #define FOR_REV(v, s, e) for (int v = e - 1; v >= s; v--) #define make_ii(a, b) make_pair(a, b) #define make_iii(a, b, c) make_pair(a, make_pair(b, c)) #define fi first #define se second //#define int long long int n, t, s; int points[505]; int results[55][505]; int memo[505][505][55]; int dp(int i, int start, int left) { if (i == t + 1 && left != 0) return 2000000001; if (i == t + 1 && left == 0) return 0; if (left == 0) return 2000000001; if (memo[i][start][left] != 0) return memo[i][start][left]; int score = 0, no_ac = 0; FOR(j, 0, n) { no_ac += (results[j][i] - results[j][start - 1] == i - start + 1); } score = no_ac * (points[i] - points[start - 1]); //cout << i << start << no_ac << '\n'; return memo[i][start][left] = min( dp(i + 1, i + 1, left - 1) + score, dp(i + 1, start, left) ); } int32_t main() { fast_input; cin >> n >> t >> s; FOR(i, 1, t + 1) { int x; cin >> x; points[i] = x + points[i - 1]; } FOR(i, 0, n) { string cs; cin >> cs; FOR(j, 1, t + 1) { results[i][j] = cs[j - 1] + results[i][j - 1] - '0'; } } FOR(ck, 1, s + 1) { cout << dp(1, 1, ck) << '\n'; FOR(i, 0, t) { FOR(j, 0, t) { FOR(k, 0, s) { memo[i][j][k] = 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...