QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#792013 | #1086. Bank Security Unification | Ame_Rain_chan | WA | 0ms | 3960kb | C++14 | 898b | 2024-11-28 22:52:32 | 2024-11-28 22:52:39 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=1e6+10;
int n;
ll a[N];
void debug(ll t){
if(t >= 2) debug(t >> 1),cerr << char((t&1)+'0');
else cerr << char((t&1)+'0');
}
int main(){
//freopen("choice.in","r",stdin);
//freopen("choice.out","w",stdout);
scanf("%d",&n);
for(int i=1;i <= n;i++){
scanf("%lld",&a[i]);
}
ll ans=0;
for(int t=0;t<1 << n;t++){
ll lst=-1,res=0;
for(int i=1;i <= n;i++){
if(!((t >> (i-1))&1)) continue;
if(lst<0) lst=a[i];
else res += lst&a[i],lst=a[i];
}
ans=max(ans,res);
}
printf("%lld",ans);
return 0;
}
/*
g++ choice.cpp -o choice -std=c++14 -O2 -static -Wall -Wextra -fsanitize=undefined
./choice < choice.in > choice.out
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3960kb
input:
5 1 2 3 1 3
output:
5
result:
ok answer is '5'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
4 1 2 4 0
output:
0
result:
ok answer is '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
2 1000000000000 1000000000000
output:
1000000000000
result:
ok answer is '1000000000000'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3912kb
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:
404976526060
result:
wrong answer expected '4105724254392', found '404976526060'