QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#392593#8332. Two in OneYia#WA 0ms3588kbC++17760b2024-04-17 17:44:062024-04-17 17:44:07

Judging History

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

  • [2024-04-17 17:44:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2024-04-17 17:44:06]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
//#define int long long
const int N=1e5+10;
int n,m1,m2;
bool cmp(int p,int q){
    return p>q;
}
void solve(){
    int x;
    cin>>n;
    vector<int>a(n+1);
    for(int i=1;i<=n;i++){
        cin>>x;
        a[x]++;
    }
    sort(a.rbegin(),a.rend());
    for(int i=1;i<=n;i++){
        if(a[i]!=a[0]){
            m2=a[i];
            break;
        }
        if(a[i]==0){
            m2=a[i-1];
            break;
        }
    }
    int ans=m1;
    int cnt=1;
    while(cnt<m2){
        cnt*=2;
    }
    cnt-=1;
    ans=max(cnt|m1,cnt|m2);
    ans=max(ans,m1|m2);
    cout<<ans<<endl;
}
signed main() {
    int T;
    cin>>T;
    while(T--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3588kb

input:

1
7
1 2 3 4 3 2 1

output:

1

result:

wrong answer 1st numbers differ - expected: '3', found: '1'