# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
977128 | Isam | Money (IZhO17_money) | C++17 | 0 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
constexpr int sz = 1e6 + 6;
int n, a[sz], ans;
set<int> st, q;
int makni = 1E9;
signed main(){
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n;
for(register int i = 1; i <= n; ++i){
cin >> a[i];
}
ans = 1;
for(register int i = 1; i <= n; ++i){
auto it = st.lower_bound(a[i-1]);
if(it != st.end()) makni = *it;
if(a[i] < a[i-1] || makni < a[i]){
++ans;
for(const int &to : q) st.insert(to);
q.clear();
}
q.insert(a[i]);
}
cout << ans << '\n';
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |