QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#792008 | #1086. Bank Security Unification | Ame_Rain_chan | Compile Error | / | / | C++14 | 901b | 2024-11-28 22:51:30 | 2024-11-28 22:51:33 |
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
*/
Details
answer.code:32:5: error: expected unqualified-id before ‘return’ 32 | return 0; | ^~~~~~ answer.code:33:1: error: expected declaration before ‘}’ token 33 | } | ^ answer.code: In function ‘int main()’: answer.code:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d",&n); | ~~~~~^~~~~~~~~ answer.code:18:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%lld",&a[i]); | ~~~~~^~~~~~~~~~~~~~