# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1203522 | emad234 | Magic Show (APIO24_show) | C++20 | 0 ms | 0 KiB |
#include "Alice.h"
#include "bits/stdc++.h"
#define F first
#define S second
#define ll long long
#define pii pair<int,int>
const int mxN = 2e5 + 5;
const int mod = 1e9 + 7;
using namespace std;
// 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(){
ll x = setN(5000);
vector<ll>idx;
for(int i = 1;i <= 5000;i++){
idx.push_back(i / 83);
}
shuffle(idx.begin(),idx.end(),mt19937(234));
vector<pii>v = {{1,2},{1,3}};
for(int i = 4;i <= 5000;i++){
if((x & (1LL << (idx[i - 1])))) {
v.push_back({2,i});
// cout<<2<<' '<<i<<' '<<idx[i - 1]<<'\n';
}
else v.push_back({3,i});
}
return v;
}
#include "Bob.h"
#include "bits/stdc++.h"
#define F first
#define S second
#define ll long long
#define pii pair<ll,ll>
const int mxN = 2e5 + 5;
const int mod = 1e9 + 7;
using namespace std;
// 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().
ll Bob(vector<pair<int,int>> V){
bool vis[70] = {}
vector<ll>idx;
vector<ll>v[4];
for(int i = 1;i <= 5000;i++){
idx.push_back(i / 83);
}
shuffle(idx.begin(),idx.end(),mt19937(234));
for(auto x : V){
if(x.F == 3 || x.F == 2) v[x.F].push_back(x.S);
}
ll st = 2;
if(v[2].size() < v[3].size()) st = 3;
ll ans = 0;
if(st == 3) ans = (1LL << 61) - 1;
for(auto x : v[st]){
if(!vis[idx[x - 1]]) ans += (1LL << idx[x - 1]) * (st == 2 ? 1 : -1);
vis[idx[x - 1]] = 1;
}
return ans;
}