# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
35187 | ulna | Money (IZhO17_money) | C++11 | 1500 ms | 52784 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;
// why am I so weak
int n;
int a[1000055];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
set<int> s;
s.insert(0), s.insert((int)1e7);
int lb = 0, ub = (int)1e7;
int res = 1;
for (int i = 0; i < n; i++) {
if (lb <= a[i] && a[i] <= ub) {
s.insert(a[i]);
lb = a[i];
continue;
}
lb = a[i];
ub = *s.upper_bound(a[i]);
res++;
s.insert(a[i]);
}
printf("%d\n", res);
return 0;
}
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... |