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;
int main() {
int N;
cin >> N;
set<int> S = {numeric_limits<int>::max()};
int ans = 0, limit = -1, last = *S.begin();
for (int i = 0; i < N; i++) {
int x;
cin >> x;
if (x > limit || x < last) {
limit = *S.upper_bound(x);
ans++;
}
S.insert(last = x);
}
cout << ans;
}
# | 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... |