QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#748775 | #8332. Two in One | DepletedPrism# | RE | 0ms | 0kb | C++23 | 646b | 2024-11-14 21:24:41 | 2024-11-14 21:24:41 |
answer
#include<bits/stdc++.h>
using namespace std;
const int N=114514;
int c[N];
int read(){
int x;
scanf("%d",&x);
}
int main(){
int T=read();
while(T--){
int n=read();
for(int i=1;i<=n;++i)
c[i]=0;
for(int i=1;i<=n;++i)
++c[read()];
int a=0,b=0;
for(int i=1;i<=n;++i){
if(c[i]>=a){
b=a;
a=c[i];
}
else if(c[i]>=b){
b=c[i];
}
}
int mx=0;
while((1<<(mx+1))<=max(a,b))++mx;
for(int i=mx;i>=0;--i){
if((a>>mx)&(b>>mx)&1){
printf("%d\n",a|b|(1<<mx)-1);
break;
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
1 7 1 2 3 4 3 2 1