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>
#define ll long long
#define INF 998244353
using namespace std;
ll a[1011011];
set< ll > st;
int main()
{
ll n;
cin>>n;
for(ll i = 1; i<= n; i ++ ){
cin>>a[i];
}
ll ans = 0, i;
st.insert(1000000000);
for( i = 1; i <= n; i ++ ){
ans++;
st.insert(a[i]);
auto x = st.upper_bound(a[i]);
while( i < n && a[i]<=a[i+1] && a[i+1]<=*x ){
st.insert(a[i+1]);
i++;
}
}
cout<<ans;
return 0;
}
# | 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... |