xiezihanAKIOI @ 2022-10-28 15:42:21
数据水了,我用 upper_bound (最长不下降子序列)过了。
by Argon_Cube @ 2022-10-28 15:43:58
@xiezihanAKIOI upper_bound 不是严格大于吗。
by xiezihanAKIOI @ 2022-10-28 15:47:06
@Antarctic_Cube 看用途
by xiezihanAKIOI @ 2022-10-28 15:49:17
@Antarctic_Cube https://www.luogu.com.cn/record/91884651
by xiezihanAKIOI @ 2022-10-28 15:50:15
将错勿喷
by Argon_Cube @ 2022-10-28 15:50:56
@xiezihanAKIOI srds,我看不到你代码。
by xiezihanAKIOI @ 2022-10-28 15:53:42
@Antarctic_Cube
#include <bits/stdc++.h>
using namespace std;
int n, m, a[100005], d[100005], len, cnt, ans, f[100005];
bool check = 0;
signed main () {
ios::sync_with_stdio (false), cin.tie (0), cout.tie (0);
cin >> n;
for (int i = 1 ; i <= n ; i++) {
cin >> a[i];
}
d[++len] = a[1];
for (int i = 2 ; i <= n ; i++) {
int j = upper_bound (d + 1, d + len + 1, a[i]) - d;
d[j] = a[i];
if (j > len) {
len++;
}
}
cout << len;
return 0;
}
by xiezihanAKIOI @ 2022-10-28 15:54:01
@xiezihanAKIOI 讲
by Argon_Cube @ 2022-10-28 15:57:36
@xiezihanAKIOI 确实水了。
但是我觉得没啥必要加强。