#include <bits/stdc++.h>
using namespace std;
#include "Alice.h"
#define pb push_back
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().
vector<pair<int,int>> Alice(){
long long x = setN(5000);
vector<int> vec;
for(long long i=0;i<60;i++){
for(long long j=1;j<=83;j++)vec.pb(i);
}
for(long long j=60*83+1;j<5000;j++)vec.pb(0LL);
shuffle(vec.begin(),vec.end(),mt19937(5328959285));
vector<pair<int,int>> ans;
for(int j=0;j<vec.size();j++) {
ans.pb({((x>>vec[j])&1) + 1, j + 1});
}
return ans;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
#define pb push_back
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().
long long Bob(vector<std::pair<int,int>> V){
vector<int> vec;
for(long long i=0;i<60;i++){
for(long long j=1;j<=83;j++)vec.pb(i);
}
for(long long j=60*83+1;j<5000;j++)vec.pb(0LL);
shuffle(vec.begin(),vec.end(),mt19937(5328959285));
int bits[60],cnt1=0,cnt2=0,ans=0;
for(auto i:V){
if(i.first==1)cnt1++;
else cnt2++;
}
for(int i=0;i<60;i++)bits[i]=(cnt1>cnt2?1:0);
for(auto i:V)bits[vec[i.second]]=i.first-1;
for(int i=0;i<60;i++)ans+=bits[i]*(1<<i);
}
Compilation message (stderr)
# 2번째 컴파일 단계
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:23:1: warning: no return statement in function returning non-void [-Wreturn-type]
23 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |