#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
const ll mod = 998244353;
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<N;i++)
#define all(A) A.begin(),A.end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr)
#include <vector>
#include "Alice.h"
// 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().
std::vector<std::pair<int,int>> Alice(){
vector<ll> P(5000);
vector<ll> Q(5000);
vector<pair<ll,ll>> R(5000);
ll a=182986938;
ll b=267916831;
ll c=379829109;
rep(i,5000){
R[i].fi=c,R[i].se=i;
c=a*c+b;
c%=mod;
}
sort(all(R));
rep(i,5000) P[i]=R[i].se;
rep(i,5000) Q[R[i].se]=i;
// add your code here
// change below into your code
ll N=5000;
ll X=setN(N);
X--;
vector<ll> x(60);
rep(i,60){
x[i]=X%2;
X/=2;
}
random_device seed_gen;
mt19937 engine(seed_gen());
uniform_real_distribution<float> dist(0,1);
vector<pair<int,int>> ans;
rep(i,60){
ll j=i*2+x[i];
ll k=i*2+i*2+1;
rep(l,5){
ll r=20*dist(engine);
ans.push_back({4980+r,j+120*l});
ans.push_back({j+120*l,k-j+120*l});
}
}
for(ll i=600;i<4980;i++){
ll j=i%60;
ll k=j*2+x[j];
ll l=5*dist(engine);
ans.push_back({k+l*120,i});
}
for(ll i=4980;i<4999;i++){
ans.push_back({i,i+1});
}
rep(i,N-1){
ans[i].fi=P[ans[i].fi]+1;
ans[i].se=P[ans[i].se]+1;
}
vector<pair<ll,ll>> T(N-1);
rep(i,N-1){
T[i].fi=mod*dist(engine);
T[i].se=i;
}
sort(all(T));
vector<pair<int,int>> ANS(N-1);
rep(i,N-1) ANS[i]=ans[T[i].se];
return ANS;
}
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
const ll mod = 998244353;
#define fi first
#define se second
#define rep(i,N) for(ll i=0;i<N;i++)
#define all(A) A.begin(),A.end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr)
#include <vector>
#include "Bob.h"
// 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(std::vector<std::pair<int,int>> V){
// add your code here
vector<ll> P(5000);
vector<ll> Q(5000);
vector<pair<ll,ll>> R(5000);
ll a=182986938;
ll b=267916831;
ll c=379829109;
rep(i,5000){
R[i].fi=c,R[i].se=i;
c=a*c+b;
c%=mod;
}
sort(all(R));
rep(i,5000) P[i]=R[i].se;
rep(i,5000) Q[R[i].se]=i;
ll N=5000;
vector<ll> deg(120,0);
ll M=V.size();
rep(i,M){
ll A=Q[V[i].fi-1],B=Q[V[i].se-1];
if(A<600) deg[A%120]++;
if(B<600) deg[B%120]++;
if(A>=4980) if(B<600) deg[B%120]+=10000;
if(B>=4980) if(A<600) deg[A%120]+=10000;
}
ll ans=0;
ll bit=1;
rep(i,60){
if(deg[i*2]<deg[i*2+1]) ans+=bit;
bit*=2;
}
return ans+1; // change this into your code
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |