# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
127353 | DodgeBallMan | Popeala (CEOI16_popeala) | C++14 | 2081 ms | 66168 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int K = 55;
int dp[N][K], cost[4500][4500], t, n, s, va[N];
char score[K][N];
void co()
{
int chk[N];
for( int i = 1 ; i <= t ; i++ ) {
int sum = 0;
memset( chk, 0, sizeof chk );
for( int j = i ; j <= t ; j++ ) {
sum += va[j];
for( int k = 1 ; k <= n ; k++ ) {
if( score[k][j] == '0' ) chk[k] = 1;
if( !chk[k] ) cost[i][j] += sum;
}
}
}
}
int main()
{
memset( dp, 127, sizeof dp );
scanf("%d %d %d",&n,&t,&s);
for( int i = 1 ; i <= t ; i++ ) scanf("%d",&va[i]);
for( int i = 1 ; i <= n ; i++ ) scanf("%s",&score[i][1]);
dp[0][0] = 0;
co();
for( int i = 1 ; i <= t ; i++ ) {
for( int j = 1 ; j <= min( s, i ) ; j++ ) {
for( int k = i ; k >= 1 ; k-- ) {
dp[i][j] = min( dp[i][j], dp[k-1][j-1] + cost[k][i] );
}
}
}
for( int i = 1 ; i <= s ; i++ ) printf("%d\n", dp[t][i] );
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |