# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
464248 |
2021-08-12T15:28:46 Z |
Hamed5001 |
Money (IZhO17_money) |
C++14 |
|
1 ms |
204 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxN = 1e6+10;
int N, A[mxN], ans;
void solve() {
cin >> N;
for (int i = 0; i < N; i++)
cin >> A[i];
multiset<int> mst;
for (int i = 0; i < N; i++) {
int j = i+1;
auto it = mst.lower_bound(A[i]);
while(j < N && (A[j] >= A[j-1]) && (it == mst.end() || *it >= A[j]))
j++;
for (int ii = i; ii < j; ii++)
mst.insert(A[ii]);
i = j-1;
ans++;
}
cout << ans;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |