# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
377051 |
2021-03-12T21:13:24 Z |
ijxjdjd |
Money (IZhO17_money) |
C++14 |
|
1 ms |
364 KB |
#include <bits/stdc++.h>
#define FR(i, N) for (int i = 0; i < int(N); i++)
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int N;
multiset<int> left;
cin >> N;
vector<int> arr(N);
FR(i, N) {
cin >> arr[i];
left.insert(arr[i]);
}
int lst = arr[N-1];
int ans = 1;
for (int i = N-2; i >= 0; i--) {
left.erase(left.find(arr[i+1]));
auto it = left.upper_bound(lst);
if (it != left.begin() && *(prev(it)) == arr[i]) {
}
else {
ans++;
}
lst = arr[i];
}
cout << ans << '\n';
return 0;
}
# |
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 |
0 ms |
364 KB |
Output is correct |
4 |
Incorrect |
0 ms |
364 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 |
0 ms |
364 KB |
Output is correct |
4 |
Incorrect |
0 ms |
364 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 |
0 ms |
364 KB |
Output is correct |
4 |
Incorrect |
0 ms |
364 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 |
0 ms |
364 KB |
Output is correct |
4 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |