Submission #536913

#TimeUsernameProblemLanguageResultExecution timeMemory
536913jamezzzPopeala (CEOI16_popeala)C++17
17 / 100
2081 ms31136 KiB
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define INF 1023456789 int t,n,s,p[20005],r[20005][50]; int c[4005][4005],z[55]; int dp[4005][55]; char ch; int main(){ sf("%d%d%d",&n,&t,&s); assert(t<=4000); for(int i=1;i<=t;++i)sf("%d",&p[i]); for(int j=0;j<n;++j){ for(int i=1;i<=t;++i){ sf(" %c",&ch); r[i][j]=ch-'0'; } } for(int i=1;i<=t;++i){ memset(z,0,sizeof z); int sm=0,num=n; for(int j=i;j<=t;++j){ sm+=p[j]; for(int k=0;k<n;++k){ if(r[j][k]==0&&!z[k]){ z[k]=1;--num; } } c[i][j]=num*sm; } } for(int i=1;i<=t;++i)dp[i][0]=INF; for(int i=1;i<=s;++i)dp[0][i]=INF; for(int i=1;i<=t;++i){ for(int k=1;k<=s;++k){ dp[i][k]=INF; for(int j=1;j<=i;++j){ dp[i][k]=min(dp[i][k],dp[j-1][k-1]+c[j][i]); } } } for(int i=1;i<=s;++i)pf("%d\n",dp[t][i]); }

Compilation message (stderr)

popeala.cpp: In function 'int main()':
popeala.cpp:14:4: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |  sf("%d%d%d",&n,&t,&s);
      |    ^
popeala.cpp:16:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  for(int i=1;i<=t;++i)sf("%d",&p[i]);
      |                         ^
popeala.cpp:19:6: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |    sf(" %c",&ch);
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...