# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
710114 |
2023-03-15T04:50:54 Z |
arcane |
Money (IZhO17_money) |
C++17 |
|
0 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
int32_t main(){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int ans = 0, n, x, prevx = -1; cin >> n;
int arr[n]; for (int i = 0; i < n; i++) cin >> arr[i];
multiset <int> ms;
bool flag = false;
for (int i = 0; i < n; i++){
ms.insert(arr[i]);
auto cur = ms.upper_bound(arr[i] - 1), prev = ms.end();
if (flag) prev = ms.lower_bound(prevx), flag = false;
else prev = ms.upper_bound(prevx - 1);
prev++;
if (prev != cur) ans += 1, flag = true;
prevx = x;
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |