# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
91094 | emil_physmath | Money (IZhO17_money) | C++14 | 2 ms | 508 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <set>
using namespace std;
int a[1000005];
int main()
{
int n;
cin>>n;
for (int k=0; k<n; k++)
scanf("%d", a+k);
int i=0, ans=0;
multiset<int> curSorted;
while (i<n)
{
ans++;
int j=i;
while (j+1<n && a[j+1]>a[j])
j++;
auto lBound=curSorted.upper_bound(a[i]);
if (lBound==curSorted.begin())
lBound=curSorted.end();
else
lBound--;
auto rBound=(lBound==curSorted.end()?curSorted.begin():++lBound);
if (rBound!=curSorted.end())
j=upper_bound(a+i, a+j+1, *rBound)-a-1;
for (int k=i; k<=j; k++)
curSorted.insert(a[k]);
i=j+1;
}
cout<<ans<<'\n';
char I;
cin >> I;
return 0;
}
컴파일 시 표준 에러 (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... |