# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
335519 | 2020-12-13T00:37:41 Z | luciocf | Money (IZhO17_money) | C++14 | 1 ms | 492 KB |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6+10; int a[maxn]; int main(void) { int n; scanf("%d", &n); multiset<int> st; for (int i = 1; i <= n; i++) { scanf("%d", &a[i]); st.insert(a[i]); } int ans = 0; for (int r = n; r >= 1; r--) { ++ans; int l = r; auto it = st.upper_bound(a[r]); --it; while (l > 1) { if (a[l-1] != *prev(it)) break; it--, l--; } for (int i = r; i >= l; i--) st.erase(st.find(a[i])); r = l; } printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Incorrect | 1 ms | 492 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Incorrect | 1 ms | 492 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Incorrect | 1 ms | 492 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Incorrect | 1 ms | 492 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |