Submission #127353

#TimeUsernameProblemLanguageResultExecution timeMemory
127353DodgeBallManPopeala (CEOI16_popeala)C++14
17 / 100
2081 ms66168 KiB
#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)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...