QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#756034 | #8332. Two in One | XiCen | WA | 0ms | 3820kb | C++20 | 535b | 2024-11-16 18:47:41 | 2024-11-16 18:47:42 |
Judging History
answer
#include<bits/stdc++.h>
signed main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);std::cout.tie(0);
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);
if(y == 0)ans = x;
else if(z == 0)ans = x ^ y;
else ans = x | z | (z - 1);
std::cout<<ans<<"\n";
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3820kb
input:
1 7 1 2 3 4 3 2 1
output:
0
result:
wrong answer 1st numbers differ - expected: '3', found: '0'