QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#730707 | #1086. Bank Security Unification | Jadonyzx | WA | 1ms | 5736kb | C++14 | 884b | 2024-11-09 21:11:25 | 2024-11-09 21:11:34 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define maxn 1000005
using namespace std;
namespace IO{
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
return x*f;
}
inline void write(int x){
if(x<0){putchar('-');x=-x;}
if(x>=10)write(x/10);
putchar(x%10+'0');return;
}
}
using namespace IO;
int n,a[maxn],dp[maxn],ans,f[100005][520];
bool ap=1,vis[520];
int res[32];
signed main(){
//45pts-65pts
// freopen("rose.in","r",stdin);
// freopen("rose.out","w",stdout);
n=read();
for(int i=1;i<=n;++i){
a[i]=read();
for(int j=0;j<=31;++j)
dp[i]=max(dp[i],dp[res[j]]+(a[i]&a[res[j]]));
for(int j=0;j<=31;++j){
if(a[i]&(1<<j))
res[j]=i;
}
ans=max(ans,dp[i]);
}
write(ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5588kb
input:
5 1 2 3 1 3
output:
5
result:
ok answer is '5'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5676kb
input:
4 1 2 4 0
output:
0
result:
ok answer is '0'
Test #3:
score: 0
Accepted
time: 1ms
memory: 5656kb
input:
2 1000000000000 1000000000000
output:
1000000000000
result:
ok answer is '1000000000000'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 5736kb
input:
100 42357619991 34637578715 14383875856 65298594968 204835436802 17842451301 27263566591 56672847581 9938910048 37783918480 178688553850 31652616803 34569713543 278151742734 458183081930 36307485267 52046737444 29733829337 156411959819 70476873663 322768771475 306850928242 68922415915 108092954267 1...
output:
3963458624976
result:
wrong answer expected '4105724254392', found '3963458624976'