#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=612769376;
    ll b=187082710;
    ll c=192097378;
    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;
    }
    vector<pair<int,int>> ans;
    rep(i,60){
        ll j=i*2+x[i];
        ll k=i*2+i*2+1;
        rep(l,5){
            ans.push_back({4999,j+120*l});
            ans.push_back({j+120*l,k-j+120*l});
        }
    }
    random_device seed_gen;
    mt19937 engine(seed_gen());
    uniform_real_distribution<float> dist(0,1);
    for(ll i=600;i<4999;i++){
        ll j=i%60;
        ll k=j*2+x[j];
        ll l=5*dist(engine);
        ans.push_back({k+l*120,i});
    }
    rep(i,N-1){
        ans[i].fi=P[ans[i].fi]+1;
        ans[i].se=P[ans[i].se]+1;
    }
    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=612769376;
    ll b=187082710;
    ll c=192097378;
    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==4999) if(B<600) deg[B%120]+=10000;
        if(B==4999) 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... |