# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
567426 |
2022-05-23T12:48:36 Z |
piOOE |
Popeala (CEOI16_popeala) |
C++17 |
|
2000 ms |
852 KB |
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) ((int)size(x))
#define trace(x) cout << #x << ": " << (x) << endl;
typedef long long ll;
#define int ll
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int S = 51, N = 51, T = 20001;
const ll infL = 3e18;
int s, n, t, A[T];
ll dp[T][S];
bool solved[N][T];
ll weight(int l, int r) {
ll every = 0;
for (int i = 1; i <= n; ++i) {
ll sum = 0;
for (int j = l; j <= r; ++j) {
if (!solved[i][j]) {
sum = 0;
break;
}
sum += A[j];
}
every += sum;
}
return every;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> t >> s;
for (int i = 1; i <= t; ++i) {
cin >> A[i];
}
for (int i = 1; i <= n; ++i) {
string ss;
cin >> ss;
for (int j = 1; j <= t; ++j) {
solved[i][j] = (ss[j - 1] == '1');
}
}
fill(dp[0] + 1, dp[0] + s + 1, infL);
for (int i = 1; i <= t; ++i) {
for (int cnt = 1; cnt <= s; ++cnt) {
dp[i][cnt] = infL;
for (int j = i - 1; j >= 0; --j) {
dp[i][cnt] = min(dp[i][cnt], dp[j][cnt - 1] + weight(j + 1, i));
}
}
}
for (int i = 1; i <= s; ++i)
cout << dp[t][i] << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Incorrect |
5 ms |
468 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2077 ms |
752 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2083 ms |
852 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Incorrect |
5 ms |
468 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |