# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
91091 | 2018-12-26T08:33:45 Z | emil_physmath | Money (IZhO17_money) | C++11 | 2 ms | 508 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; multiset<int> curSorted; while (i<n) { ans++; int j=i; while (j+1<n && a[j+1]>a[j]) j++; auto it=curSorted.lower_bound(a[i]); if (it!=curSorted.end()) j=upper_bound(a+i, a+j+1, *it)-a; 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 | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 508 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 508 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 508 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 348 KB | Output is correct |
2 | Incorrect | 2 ms | 508 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |