#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
616 KB |
Output is correct |
4 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
616 KB |
Output is correct |
4 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
616 KB |
Output is correct |
4 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
616 KB |
Output is correct |
4 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |