Submission #89744

#TimeUsernameProblemLanguageResultExecution timeMemory
89744RAkhshonMoney (IZhO17_money)C++14
45 / 100
1534 ms145964 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...