目测最短代码

P1439 【模板】最长公共子序列

NewSjf @ 2019-08-31 12:09:34

不接受反驳

#include<bits/stdc++.h>
using namespace std;
int main(){
    static int n,a,b[100001],c[100001],mp[100001];cin>>n;
    for(int i=1;i<=n;i++)cin>>a,mp[a]=i,c[i]=252645135;
    for(int i=1;i<=n;i++)cin>>b[i],*upper_bound(c+1,c+n+1,mp[b[i]])=mp[b[i]]; 
    cout<<(upper_bound(c+1,c+1+n,n+1)-c-1);
}

by wjy2006 @ 2019-08-31 12:10:50

orz发题解叭!!!


by NaCly_Fish @ 2019-08-31 12:11:37

去掉static,可以更短(


by ezoixx130 @ 2019-08-31 12:11:59

还是可以压的


by Liuier @ 2019-08-31 12:12:06

static...


by SSerxhs @ 2019-08-31 12:14:07

最短代码你还static啥哦...


by t162 @ 2019-08-31 12:15:57

反驳

#include<bits/stdc++.h>
using namespace std;int main(){int n,a,b[100001],c[100001],mp[100001];cin>>n;for(int i=1;i<=n;i++)cin>>a,mp[a]=i,c[i]=252645135;for(int i=1;i<=n;i++)cin>>b[i],*upper_bound(c+1,c+n+1,mp[b[i]])=mp[b[i]]; cout<<(upper_bound(c+1,c+1+n,n+1)-c-1);}

by FZzzz @ 2019-08-31 12:23:05

膜鱼


by SSerxhs @ 2019-08-31 12:24:58

@Bambusoideae

#include<bits/stdc++.h>
const int A=2e5;using namespace std;int i,n,a,b[A],c[A],m[A];int main(){for(cin>>n;i<n;c[i++]=A)cin>>a,m[a]=i;for(i=-1;++i<n;cin>>b[i],*upper_bound(c,c+n,m[b[i]])=m[b[i]]);cout<<upper_bound(c,c+n,n+1)-c;}

by Hjcc @ 2019-08-31 12:26:42

@function_of_zero 又见面了


by 只以 @ 2019-08-31 12:27:21

可以极致压到两行


| 下一页