# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
344623 |
2021-01-06T06:41:50 Z |
SeDunion |
Money (IZhO17_money) |
C++17 |
|
1 ms |
364 KB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e6 + 66;
int a[N], ans;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int n;
cin >> n;
set<int>S = {N};
for (int i = 1 ; i <= n ; ++ i) cin >> a[i];
for (int i = 1 ; i <= n ; ++ i) {
int j = i + 1;
auto it = S.upper_bound(a[i]);
while (j <= n && a[j] >= a[j - 1] && (a[j] == a[i] || S.lower_bound(a[i]) == it)) ++j;
j--;
S.insert(a[i]);
S.insert(a[j]);
ans++;
i = j;
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |