QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#748775#8332. Two in OneDepletedPrism#RE 0ms0kbC++23646b2024-11-14 21:24:412024-11-14 21:24:41

Judging History

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

  • [2024-11-14 21:24:41]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [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

output:


result: