# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
250681 | 2020-07-18T17:19:44 Z | kingfran1907 | Baloni (COCI15_baloni) | C++14 | 1076 ms | 92428 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6+10; int n; set< int > s[maxn]; int main() { scanf("%d", &n); for (int i = 0; i < n; i++) { int x; scanf("%d", &x); s[x].insert(i); } int sol = 0; for (int i = maxn - 10; i >= 0; i--) { while (!s[i].empty()) { int las = -1; int x = i; while (true) { auto iter = s[x].lower_bound(las); if (iter == s[x].end()) break; las = *iter + 1; s[x].erase(iter); x--; } sol++; } } printf("%d\n", sol); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 34 ms | 47352 KB | Output is correct |
2 | Correct | 28 ms | 47360 KB | Output is correct |
3 | Correct | 35 ms | 47480 KB | Output is correct |
4 | Correct | 29 ms | 47488 KB | Output is correct |
5 | Correct | 1074 ms | 88056 KB | Output is correct |
6 | Correct | 1071 ms | 92428 KB | Output is correct |
7 | Correct | 925 ms | 84564 KB | Output is correct |
8 | Correct | 821 ms | 83960 KB | Output is correct |
9 | Correct | 936 ms | 86392 KB | Output is correct |
10 | Correct | 1076 ms | 87664 KB | Output is correct |