Submission #1203547

#TimeUsernameProblemLanguageResultExecution timeMemory
1203547ereringMagic Show (APIO24_show)C++20
100 / 100
2 ms588 KiB
#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-1;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 + 3});
    }
    ans.pb({1,2});
    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-1;j++)vec.pb(0LL);
    shuffle(vec.begin(),vec.end(),mt19937(5328959285));
    int bits[60],a[2];
    long long ans=0;
    for(auto i:V){
        if(i.first==1 && i.second==2)continue;
        a[i.first-1]++;
    }
    for(int i=0;i<60;i++)bits[i]=(a[0]>a[1]?1:0);
    for(auto i:V){
        if(i.second==2)continue;
        bits[vec[i.second-3]]=i.first-1;
    }
    for(long long i=0;i<60;i++){
        ans+=bits[i]*(1LL<<i);
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...