# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164798 | mosiashvililuka | Money (IZhO17_money) | C++14 | 1556 ms | 5632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |