QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#742202 | #8332. Two in One | XiCen | WA | 0ms | 3788kb | C++20 | 620b | 2024-11-13 16:04:25 | 2024-11-13 16:04:26 |
Judging History
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 ^ (z - 1);
std::cout<<ans<<"\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3788kb
input:
1 7 1 2 3 4 3 2 1
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3560kb
input:
1 9 1 1 1 1 1 2 2 2 2
output:
6
result:
wrong answer 1st numbers differ - expected: '7', found: '6'