对拍

#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,a[N],f[N],ans;
int main()
{
    freopen("data.in","r",stdin);
    freopen("true.out","w",stdout); 
    scanf("%d",&n);
    for(int i=1;i<=n;i++)    scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
    {
        int maxn=0,x=a[i];
        for(int j=0;(1<<j)<=x;j++)
        {
            if(x&(1<<j))    maxn=max(maxn,f[j]+1);
        }
    //    cout<<maxn<<endl;
        for(int j=0;(1<<j)<=x;j++)
        {
            if(x&(1<<j))    f[j]=maxn;
        } 
        for(int j=0;j<=32;j++)    ans=max(ans,f[j]);
    }
    printf("%d",ans);
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
    for(int i=1;i<=10000;i++)
    {
        system("D:\\a.exe");
        double st=clock();
        system("D:\\true.exe");
        double ed=clock();
        system("D:\\wrong.exe");
        if(system("fc D:\\true.out D:\\wrong.out"))
        {
            puts("Wrong Answer");
            return 0;
        }
        else
        {
            printf("Accepted,测试点 # %d,用时 %.0lfms\n",i,ed-st);
        }
    }
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int n,a[N],f[N];
int main()
{
    freopen("data.in","r",stdin);
    freopen("wrong.out","w",stdout); 
    scanf("%d",&n);
    for(int i=1;i<=n;i++)    scanf("%d",&a[i]);
    f[1]=1;
    for(int i=1;i<=n;i++)
    for(int j=1;j<i;j++)
    {
        if((a[i]&a[j])!=0)
        f[i]=max(f[i],f[j]+1);
    }
    printf("%d",f[n]);
    return 0;
}

 

#include<bits/stdc++.h>
using namespace std;
int random(int n)
{
	return (long long)rand()*rand()%n;
}
int main()
{
	freopen("data.in","w",stdout);
	srand(unsigned(time(0)));
	int n=random(5000)+1;
	cout<<n<<endl;
	for(int i=1;i<=n;i++)
	{
		int x=random(4000)+1;
		cout<<x<<" ";
	}
	return 0;
}

  

posted @ 2022-01-09 17:35  伪学霸  阅读(11)  评论(0)    收藏  举报