Submission #1126596

#TimeUsernameProblemLanguageResultExecution timeMemory
1126596brover29Money (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++){ if(a[i]==a[i-1]){ continue; } auto j=s.lower_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...