# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
598369 |
2022-07-18T07:44:59 Z |
1bin |
Popeala (CEOI16_popeala) |
C++14 |
|
20 ms |
2644 KB |
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
typedef long long ll;
const int MAX = 2e4 + 5;
int n, t, s, dp[55][MAX], p[MAX], chk[55][MAX], bf[55][MAX], ix[MAX][55], pf[MAX];
string w;
int main(void){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> t >> s;
for(int i = 1; i <= t; i++) cin >> p[i], pf[i] = pf[i - 1] + p[i];
for(int i = 0; i < n; i++){
cin >> w;
for(int j = 0; j < t; j++) chk[i + 1][j + 1] = w[j] - '0';
}
for(int i = 1; i <= n; i++)
for(int j = 1; j <= t; j++){
bf[i][j] = (chk[i][j] ? bf[i][j - 1] : j);
ix[j][i - 1] = bf[i][j];
}
for(int i = 1; i <= t; i++) sort(ix[i], ix[i] + n);
for(int j = 1; j <= t; j++)
for(int i = 1; i <= n; i++)
if(!bf[i][j]) dp[1][j] += pf[j];
cout << dp[1][t] << '\n';
for(int i = 2; i <= s; i++){
for(int j = i; j <= t; j++){
dp[i][j] = dp[i - 1][j - 1] + (pf[j] - pf[j - 1]) * n;
for(int k = 0; k < n; k++){
if(ix[j][k] >= i) dp[i][j] = min(dp[i][j], dp[i - 1][ix[j][k] - 1] + (pf[j] - pf[ix[j][k] - 1]) * k);
}
//cout << dp[i][j] << ' ';
}
//cout << '\n';
cout << dp[i][t] << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
1236 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
2644 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
724 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |