Submission #89746

#TimeUsernameProblemLanguageResultExecution timeMemory
89746RAkhshonMoney (IZhO17_money)C++14
45 / 100
1573 ms62172 KiB
#include <bits/stdc++.h> #define ll long long #define INF 998244353 using namespace std; ll a[1011011]; set< ll > st; int main() { ios_base::sync_with_stdio(0); ll n; cin>>n; for(ll i = 1; i<= n; i ++ ){ cin>>a[i]; } ll ans = 0, i; st.insert(1000000000); st.insert(0); 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...