QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#647191 | #8823. Game: Battle of Menjis | planckconstant# | WA | 60ms | 3852kb | C++14 | 1.6kb | 2024-10-17 12:33:56 | 2024-10-17 12:33:58 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define double long double
#define INF 1e15
void slove()
{
int n,m;
cin>>n>>m;
vector<int>a(n);
int re=0;
for(int i=0;i<n;i++){
cin>>a[i];
re^=a[i];
}
map<pair<int,int>,int>b1;
map<int,int>b2;
for(int i=0;i<n;i++){
int ans1=0;
int ans2=0;
if(!a[i]){
continue;
}
for(int j=0;j<40;j++){
if(((a[i]>>j)&1)==1){
ans1++;
}
else{
ans1++;
break;
}
}
for(int j=0;j<40;j++){
if(((a[i]>>j)&1)==0){
ans2++;
}
else{
ans2++;
break;
}
}
b1[{ans1,ans2}]++;
b2[ans2]++;
}
int my_max=0;
for(auto [x,num]:b1){
int ans=re;
int my_min=re;
ans^=(((ll)1<<x.first)-1);
b2[x.first]++;
b2[x.second]--;
for(auto [y,num2]:b2){
if(num2==0){
continue;
}
ans^=(((ll)1<<y)-1);
my_min=min(my_min,ans);
ans^=(((ll)1<<y)-1);
}
b2[x.first]--;
b2[x.second]++;
my_max=max(my_max,my_min);
}
cout<<my_max<<endl;
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=1;
cin >> t;
while (t--) {
slove();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
input:
4 2 3 1 1 4 4 0 0 0 0 4 1 1 2 4 8 13 5 1 1 4 5 1 4 1 9 1 9 8 1 0
output:
0 0 9 11
result:
ok 4 number(s): "0 0 9 11"
Test #2:
score: -100
Wrong Answer
time: 60ms
memory: 3852kb
input:
100000 1 5 0 4 5 4 4 3 5 5 2 0 1 7 5 4 4 1 6 4 4 4 1 5 3 2 2 1 1 3 1 5 4 0 2 4 0 3 2 2 1 7 3 1 2 1 6 2 4 5 1 3 1 3 7 0 4 4 7 5 4 4 3 3 1 1 5 1 3 3 3 2 3 7 4 4 1 3 1 0 5 5 3 6 2 3 6 3 3 1 2 6 6 4 4 5 4 1 3 2 1 4 4 4 5 0 1 6 5 4 5 0 7 7 5 2 4 4 0 5 1 7 0 2 6 0 3 4 5 2 3 2 3 4 3 3 2 1 0 1 2 2 6 5 5 1 6...
output:
0 2 7 2 3 0 1 3 6 5 4 4 2 5 3 0 5 2 0 3 0 2 5 4 3 4 7 0 3 2 4 4 4 2 4 6 1 3 2 7 4 7 4 6 2 4 4 3 7 0 2 2 1 0 6 7 0 0 1 7 1 3 3 6 2 1 5 5 5 1 6 4 1 2 0 7 1 4 3 6 7 7 0 1 7 0 0 4 0 4 7 7 7 4 6 2 5 4 7 4 1 4 4 4 3 4 7 5 4 4 3 6 1 2 5 4 2 1 1 0 0 0 0 6 1 3 4 0 1 4 6 3 1 3 5 1 0 6 3 2 1 4 5 2 1 2 2 7 6 7 ...
result:
wrong answer 17th numbers differ - expected: '7', found: '5'