Submission #127353

# Submission time Handle Problem Language Result Execution time Memory
127353 2019-07-09T09:13:10 Z DodgeBallMan Popeala (CEOI16_popeala) C++14
17 / 100
2000 ms 66168 KB
#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

popeala.cpp: In function 'int main()':
popeala.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d %d",&n,&t,&s);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~
popeala.cpp:30:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for( int i = 1 ; i <= t ; i++ ) scanf("%d",&va[i]);
                                     ~~~~~^~~~~~~~~~~~~
popeala.cpp:31:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for( int i = 1 ; i <= n ; i++ ) scanf("%s",&score[i][1]);
                                     ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 39 ms 44168 KB Output is correct
2 Correct 41 ms 44536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 46940 KB Output is correct
2 Correct 85 ms 46840 KB Output is correct
3 Correct 88 ms 46840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 960 ms 56400 KB Output is correct
2 Execution timed out 2081 ms 66168 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 44168 KB Output is correct
2 Correct 41 ms 44536 KB Output is correct
3 Correct 89 ms 46940 KB Output is correct
4 Correct 85 ms 46840 KB Output is correct
5 Correct 88 ms 46840 KB Output is correct
6 Correct 960 ms 56400 KB Output is correct
7 Execution timed out 2081 ms 66168 KB Time limit exceeded
8 Halted 0 ms 0 KB -