# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91095 | 2018-12-26T08:51:39 Z | emil_physmath | Money (IZhO17_money) | C++14 | 2 ms | 520 KB |
#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; set<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; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 520 KB | Output is correct |
4 | Correct | 1 ms | 520 KB | Output is correct |
5 | Correct | 1 ms | 520 KB | Output is correct |
6 | Correct | 2 ms | 520 KB | Output is correct |
7 | Incorrect | 2 ms | 520 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 520 KB | Output is correct |
4 | Correct | 1 ms | 520 KB | Output is correct |
5 | Correct | 1 ms | 520 KB | Output is correct |
6 | Correct | 2 ms | 520 KB | Output is correct |
7 | Incorrect | 2 ms | 520 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 520 KB | Output is correct |
4 | Correct | 1 ms | 520 KB | Output is correct |
5 | Correct | 1 ms | 520 KB | Output is correct |
6 | Correct | 2 ms | 520 KB | Output is correct |
7 | Incorrect | 2 ms | 520 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 372 KB | Output is correct |
3 | Correct | 2 ms | 520 KB | Output is correct |
4 | Correct | 1 ms | 520 KB | Output is correct |
5 | Correct | 1 ms | 520 KB | Output is correct |
6 | Correct | 2 ms | 520 KB | Output is correct |
7 | Incorrect | 2 ms | 520 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |