이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define mp make_pair
#define ll long long
#define int long long
#define itr iterator
typedef pair<ll,ll> pii;
const ll MAX=2e6;
const ll INF=1e12;
set<int> st;
set<int> ::itr it;
int N,res,arr[MAX];
signed main()
{
ios_base::sync_with_stdio(false);
cin>>N;
for(int A=1;A<=N;A++)
cin>>arr[A];
st.insert(0);
st.insert(MAX);
for(int A=1;A<=N;)
{
it=st.upper_bound(arr[A]);
res++;
while(A<=N)
{
st.insert(arr[A]);
if(arr[A+1]>=arr[A] and arr[A+1]<*it)
A++;
else
break;
}
A++;
}
cout<<res;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |