# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
608714 |
2022-07-27T09:34:54 Z |
proma |
Popeala (CEOI16_popeala) |
C++17 |
|
2000 ms |
24248 KB |
#include <bits/stdc++.h>
//#define int long long
#define see(x) cout<<#x<<"="<<x<<endl;
#define endl "\n"
using namespace std;
const int N = 20005;
const int INF = 1e9;
int n, t, s, points[N];
char results[55][N];
int pref[55][N], sum[N], substak[N][N];
int dp[N][55];
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
/*
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
*/
cin >> n >> t >> s;
for (int i = 1; i <= t; i ++) {
cin >> points[i];
sum[i] = sum[i-1] + points[i];
}
for (int i = 0; i < n; i ++) {
for (int j = 1; j <= t; j ++) {
cin >> results[i][j];
}
}
for (int i = 0; i < n; i ++) {
for (int j = 1; j <= t; j ++) {
pref[i][j] = pref[i][j-1];
if (results[i][j] == '0') pref[i][j] ++;
}
}
for (int i = 1; i <= t; i ++) {
for (int j = i; j <= t; j ++) {
for (int k = 0; k < n; k ++) {
if (pref[k][j] - pref[k][i-1] == 0) substak[i][j] += sum[j] - sum[i-1];
}
}
}
for (int i = 1; i <= t; i ++) {
dp[i][1] = substak[1][i];
for (int j = 2; j <= s; j ++) {
dp[i][j] = INF;
for (int k = j - 1; k < i; k ++) {
dp[i][j] = min(dp[i][j], dp[k][j-1] + substak[k+1][i]);
}
}
}
for (int i = 1; i <= s; i ++) {
cout << dp[t][i] << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
3472 KB |
Output is correct |
2 |
Correct |
17 ms |
3412 KB |
Output is correct |
3 |
Correct |
18 ms |
3492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
786 ms |
13928 KB |
Output is correct |
2 |
Execution timed out |
2055 ms |
24248 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
724 KB |
Output is correct |
3 |
Correct |
19 ms |
3472 KB |
Output is correct |
4 |
Correct |
17 ms |
3412 KB |
Output is correct |
5 |
Correct |
18 ms |
3492 KB |
Output is correct |
6 |
Correct |
786 ms |
13928 KB |
Output is correct |
7 |
Execution timed out |
2055 ms |
24248 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |