QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#640465#1086. Bank Security UnificationDay_TaoRE 0ms0kbC++141.3kb2024-10-14 13:02:182024-10-14 13:02:20

Judging History

你现在查看的是最新测评结果

  • [2024-10-14 13:02:20]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-10-14 13:02:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long
#define pii pair<int,int>
#define mid ((l+r)>>1)
#define fi first
#define se second
#define SZ(a) ((int)(a).size())
#define END(a) (prev((a).end()))
#define pc(a) putchar(a)
#define pb(a) push_back(a)
#define no return puts("NO"),void()
#define yes return puts("YES"),void()
typedef long long ll;
const int N = 1e6+5;
const int mod = 998244353;
const ll INFLL = LONG_LONG_MAX;
const int INF = INT_MAX;
inline void cmax(int&a,int b){a=max(a,b);}
inline void cmin(int&a,int b){a=min(a,b);}
inline void add(int&a,int b){a+=b;if(a>=mod)a-=mod;}
inline int read()
{
	int x=0,y=1;char c=getchar();
	for(;c<'0'||c>'9';c=getchar())if(c=='-')y=-1;
	for(;c>='0'&&c<='9';c=getchar())x=(x<<1)+(x<<3)+(c^48);
	return x*y;
}
int n,a[N],f[N],ans,mx,g[N];
inline void SOLVE()
{
	n=read();for(int i=1;i<=n;i++)a[i]=read();
	for(int i=1;i<=63;i++)if(a[1]&(1ll<<i))g[i]=1;
	for(int i=2;i<=n;i++)
	{
		f[i]=mx;
		for(int j=63;~j;j--)if(a[i]&(1ll<<j))cmax(f[i],f[g[j]]+(a[i]&a[g[j]])),g[j]=i;
		cmax(mx,f[i]);
	}
	printf("%lld\n",mx);
	return ;
}
signed main()
{
	freopen("rose.in","r",stdin);
	freopen("rose.out","w",stdout);
	int T=1;while(T--) SOLVE();return 0;
}

詳細信息

Test #1:

score: 0
Dangerous Syscalls

input:

5
1 2 3 1 3

output:


result: