# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
341443 | katearima | Money (IZhO17_money) | C++14 | 1 ms | 364 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;
const int N=1e6+5;
int n,t,ans, a[N], mn,mx;
set <int> st;
set<int>::iterator itr;
main(){
cin>>n;
mn=1e6+4;
for(int i=0; i<n; i++){
cin>>a[i];
mx=max(mx, a[i]);
mn=min(mn, a[i]);
}
mn--; mx++;
st.insert(mn); st.insert(mx);
for(int i=0; i<n; i++){
st.insert(a[i]);
while(a[i]<=a[i+1] && a[i+1]<= *st.upper_bound(a[i])){
st.insert(a[i+1]);
i++;
}
ans++;
}
cout<<ans<<endl;
}
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... |