Submission #284953

#TimeUsernameProblemLanguageResultExecution timeMemory
284953mosiashvililukaDischarging (NOI20_discharging)C++14
47 / 100
198 ms10488 KiB
#include<bits/stdc++.h> using namespace std; long long a,b,c,d,e,i,j,ii,jj,zx,xc,dp[1000009],f[1000009],mx; int main(){ //ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); scanf("%d",&a); scanf("\n"); for(i=1; i<=a; i++) scanf("%d",&f[i]); if(a<=1500){ dp[0]=0; for(i=1; i<=a; i++){ dp[i]=999999999999999999LL; mx=0; for(j=i-1; j>=0; j--){ if(mx<f[j+1]) mx=f[j+1]; if(dp[i]>dp[j]+mx*(a-j)) dp[i]=dp[j]+mx*(a-j); } } cout<<dp[a]; }else{ cout<<f[1]*a; } return 0; }

Compilation message (stderr)

Discharging.cpp: In function 'int main()':
Discharging.cpp:6:13: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
    6 |     scanf("%d",&a);
      |            ~^  ~~
      |             |  |
      |             |  long long int*
      |             int*
      |            %lld
Discharging.cpp:8:33: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
    8 |     for(i=1; i<=a; i++) scanf("%d",&f[i]);
      |                                ~^  ~~~~~
      |                                 |  |
      |                                 |  long long int*
      |                                 int*
      |                                %lld
Discharging.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    6 |     scanf("%d",&a);
      |     ~~~~~^~~~~~~~~
Discharging.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |     scanf("\n");
      |     ~~~~~^~~~~~
Discharging.cpp:8:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     for(i=1; i<=a; i++) scanf("%d",&f[i]);
      |                         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...