# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
92667 | GioChkhaidze | Money (IZhO17_money) | C++14 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int n,a[1000006],f[1000006],fix[1000006],Ans;
set < int > st;
void go(int x,int idx)
{
int ko=0;
Ans++;
fix[idx]=1;
st.insert(x);
for (int i=idx+1; i<=n; i++)
{
if (a[i]<x) break;
if (st.upper_bound(x)==st.end() || a[i]<*st.upper_bound(x))
{
fix[i]=1;
st.insert(a[i]);
x=a[i];
}
else break;
}
}
main ()
{
ios::sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n; i++)
{
cin>>a[i];
f[a[i]]=i;
}
for (int i=1; i<=n; i++)
{
if (!fix[f[i]]) go(i,f[i]);
/*
for (int j=1; j<=n; j++)
cout<<fix[j]<<" ";
cout<<endl;*/
}
cout<<Ans<<endl;
}
/*
10
1 4 6 2 3 7 10 8 9 5
| 1 4 6 | 2 3 | 7 10 | 8 9 | 5 |
6
3 6 4 5 1 2
5
1 3 5 2 4
8
1 3 2 4 5 8 7 6
4
2 2 2 2
*/
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |