Submission #164796

# Submission time Handle Problem Language Result Execution time Memory
164796 2019-11-23T12:02:03 Z mosiashvililuka Money (IZhO17_money) C++14
0 / 100
2 ms 376 KB
#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[d]);
    return 0;
}

Compilation message

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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -