제출 #494950

#제출 시각아이디문제언어결과실행 시간메모리
494950Ronin13Money (IZhO17_money)C++14
9 / 100
1 ms320 KiB
#include<bits/stdc++.h> #define ll long long #define ull unsigned ll #define f first #define s second #define pii pair<int,int> #define pll pair<ll,ll> #define pb push_back #define epb emplace_back #define inf 1e9+1 #define linf 1e18+1 using namespace std; const int NMAX=1e6+1; void solve(){ int n;cin>>n; int a[n+1]; for(int i=1;i<=n;i++)cin>>a[i]; set<int>st; int l=1; int r=2; int cnt=0; while(r<=n){ int x; if(st.size()==0)x=inf; else x=*st.upper_bound(a[l]); if((a[r]>=a[r-1])&&(x>=a[r])){ r++; } else{ cnt++; for(int i=l;i<r;i++){ st.insert(a[i]); } l=r; r++; } } cnt++; cout<<cnt<<"\n"; } int main(){ ios_base::sync_with_stdio(false);cin.tie(0); int test=1;//cin>>test; while(test--)solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...