QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#649356#8332. Two in OneSredWA 0ms3644kbC++17615b2024-10-17 23:00:422024-10-17 23:00:43

Judging History

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

  • [2024-10-17 23:00:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3644kb
  • [2024-10-17 23:00:42]
  • 提交

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'