#include <bits/stdc++.h>
#define lb lower_bound
#define ub upper_bound
using namespace std;
const int N = 1e5+5;
int n, m, k;
signed main() {
ios::sync_with_stdio();
cin.tie(0);
cout.tie(0);
// freopen("0.in", "r", stdin);
// freopen("0.out", "w", stdout);
cin >> n;
set <int> vals;
for (int i = 1; i <= n; i++) {
int x; cin >> x;
if (i == 1) {
vals.insert(x);
continue;
}
if (*vals.begin() > x) {
vals.insert(x);
} else {
auto it = vals.ub(x);
if (it != vals.end()) vals.erase(it);
vals.insert(x);
}
// for (auto& el : vals) cout << el << ' '; cout << "\n";
}
cout << vals.size() << ' ' << '\n';
};
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
316 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
11 |
Incorrect |
99 ms |
5140 KB |
Output isn't correct |
12 |
Incorrect |
88 ms |
4524 KB |
Output isn't correct |
13 |
Incorrect |
85 ms |
4216 KB |
Output isn't correct |
14 |
Incorrect |
73 ms |
1584 KB |
Output isn't correct |
15 |
Incorrect |
93 ms |
1964 KB |
Output isn't correct |
16 |
Incorrect |
100 ms |
2208 KB |
Output isn't correct |
17 |
Incorrect |
86 ms |
4680 KB |
Output isn't correct |
18 |
Incorrect |
84 ms |
4716 KB |
Output isn't correct |
19 |
Incorrect |
82 ms |
4716 KB |
Output isn't correct |
20 |
Incorrect |
93 ms |
4792 KB |
Output isn't correct |