제출 #84334

#제출 시각아이디문제언어결과실행 시간메모리
84334zoooma13Baloni (COCI15_baloni)C++14
0 / 100
1935 ms132096 KiB
#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; ms.erase(i); ss[i].erase(it); i--; } Ans++; } cout << Ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...