QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#649356 | #8332. Two in One | Sred | WA | 0ms | 3644kb | C++17 | 615b | 2024-10-17 23:00:42 | 2024-10-17 23:00:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e6 + 5;
const int mod = 1e9 + 7;
map<int,int> mp;
int a[maxn];
void solve(){
int n;
cin >> n;
mp.clear();
for(int i = 1;i <= n ;i ++) cin >> a[i],mp[a[i]]++;
int id = 0,id1 = 0;
int mx = 0;
for(auto [x,y] : mp){
if(y >= mx) id1 = id,id = x,mx = y;
}
id1 = mp[id1];
id = mp[id];
mx = 0;
for(int i = 0 ;i <= id1;i ++) mx = max(mx,id | i);
cout << mx << endl;
}
int main(){
int t = 1;
cin >> t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
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: 3576kb
input:
1 9 1 1 1 1 1 2 2 2 2
output:
5
result:
wrong answer 1st numbers differ - expected: '7', found: '5'