# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
84335 | zoooma13 | Baloni (COCI15_baloni) | C++14 | 2077 ms | 132096 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 1000006
int GIR; char GIC;
inline int GI() {
GIR = 0 ,GIC = getchar();
while(GIC < '0' || '9' < GIC)
GIC = getchar();
while('0' <= GIC && GIC <= '9') {
GIR = (GIR * 10) + (GIC - '0');
GIC = getchar();
}
return GIR;
}
int N ,A;
set <int> ss[MAX_N];
multiset <int> ms;
int main()
{
N = GI(); assert(N < MAX_N);
for(int i=0; i<N; i++)
{
A = GI();
ss[A].insert(i);
ms.insert(A);
}
int Ans = 0;
set<int>::iterator it;
while(!ms.empty())
{
int i = *prev(ms.end());
int j = -1;
while(true)
{
it = ss[i].upper_bound(j);
if(it == ss[i].end())
break;
j = *it;
ss[i].erase(it);
ms.erase(ms.find(i--));
}
Ans++;
}
cout << Ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |