#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() << " 1" << '\n';
};
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
212 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 |
1 ms |
212 KB |
Output isn't correct |
11 |
Incorrect |
94 ms |
4064 KB |
Output isn't correct |
12 |
Incorrect |
86 ms |
3644 KB |
Output isn't correct |
13 |
Incorrect |
78 ms |
3420 KB |
Output isn't correct |
14 |
Incorrect |
90 ms |
448 KB |
Output isn't correct |
15 |
Incorrect |
88 ms |
460 KB |
Output isn't correct |
16 |
Incorrect |
105 ms |
452 KB |
Output isn't correct |
17 |
Incorrect |
82 ms |
3680 KB |
Output isn't correct |
18 |
Incorrect |
83 ms |
3620 KB |
Output isn't correct |
19 |
Incorrect |
83 ms |
3604 KB |
Output isn't correct |
20 |
Incorrect |
82 ms |
3656 KB |
Output isn't correct |