Submission #164798

#TimeUsernameProblemLanguageResultExecution timeMemory
164798mosiashvililukaMoney (IZhO17_money)C++14
45 / 100
1556 ms5632 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,pas,f[1000009],dp[1000009]; int main(){ scanf("%d",&a); for(b=1; b<=a; b++){ scanf("%d",&f[b]); } dp[0]=0; for(b=1; b<=a; b++){ dp[b]=a+3; for(c=b; c>=1; c--){ if(c!=b&&f[c]>f[c+1]) break; e=0; for(d=1; d<c; d++){ if(f[c]<f[d]&&f[d]<f[b]){ e=1; break; } } if(e==0){ if(dp[b]>dp[c-1]+1) dp[b]=dp[c-1]+1; } } } printf("%d ",dp[a]); return 0; }

Compilation message (stderr)

money.cpp: In function 'int main()':
money.cpp:5:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&a);
     ~~~~~^~~~~~~~~
money.cpp:7:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&f[b]);
         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...