QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#742211#8332. Two in OneXiCenWA 0ms3552kbC++20624b2024-11-13 16:05:572024-11-13 16:05:57

Judging History

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

  • [2024-11-13 16:05:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-11-13 16:05:57]
  • 提交

answer

#include<bits/stdc++.h>
//#define int long long

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);

    int T;std::cin >> T;
    while (T--)
    {
        int n;std::cin>>n;

        std::vector<int> a(n+1,0),cnt(n+1,0);
        for(int i = 1;i<=n;++i)std::cin>>a[i],cnt[a[i]]++;

        std::sort(cnt.begin(),cnt.end());

        int ans = 0;
        int x = cnt[n],y = cnt[n - 1],z = x & y;
        while(z - (z & -z) > 0)z -= (z & -z);
        z = std::max(z,1);
        ans = (x^y) | (z - 1);
        std::cout<<ans<<"\n";
    }

    return 0;
}

详细

Test #1:

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

input:

1
7
1 2 3 4 3 2 1

output:

1

result:

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