# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91099 | 2018-12-26T09:08:46 Z | emil_physmath | Money (IZhO17_money) | C++14 | 2 ms | 628 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; curSorted.insert(0); while (i<n) { ans++; int j=i; while (j+1<n && a[j+1]>a[j]) j++; auto rBound=curSorted.upper_bound(a[i]); 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 | 500 KB | Output is correct |
3 | Correct | 2 ms | 500 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 2 ms | 500 KB | Output is correct |
6 | Correct | 2 ms | 500 KB | Output is correct |
7 | Incorrect | 2 ms | 628 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 | 500 KB | Output is correct |
3 | Correct | 2 ms | 500 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 2 ms | 500 KB | Output is correct |
6 | Correct | 2 ms | 500 KB | Output is correct |
7 | Incorrect | 2 ms | 628 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 | 500 KB | Output is correct |
3 | Correct | 2 ms | 500 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 2 ms | 500 KB | Output is correct |
6 | Correct | 2 ms | 500 KB | Output is correct |
7 | Incorrect | 2 ms | 628 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 | 500 KB | Output is correct |
3 | Correct | 2 ms | 500 KB | Output is correct |
4 | Correct | 2 ms | 500 KB | Output is correct |
5 | Correct | 2 ms | 500 KB | Output is correct |
6 | Correct | 2 ms | 500 KB | Output is correct |
7 | Incorrect | 2 ms | 628 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |