Submission #1126593

#TimeUsernameProblemLanguageResultExecution timeMemory
1126593brover29Money (IZhO17_money)C++20
0 / 100
4 ms4936 KiB
#include <bits/stdc++.h> //qwerty47924692 using namespace std; #define f first #define s second using ll = long long; const ll N=2e5+29; const string br="617283"; ll n,a[N],ans=1,k; vector<ll>b[N]; set<ll>s; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin>>n; for(ll i=1;i<=n;i++){ cin>>a[i]; } s.insert(a[1]); for(ll i=2;i<=n;i++){ auto j=s.upper_bound(a[i]); if(j==s.begin()){ ans++; s.insert(a[i]); continue; } j--; if(*j!=a[i-1]){ ans++; } s.insert(a[i]); } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...