#include <vector>
#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
// 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(){
long long x = setN(5000);
vector<pair<int, int>>vp;
if (x==25000000)
{
for (int i=1 ; i<5000 ; i++)
vp.push_back({i, i+1});
return vp;
}
/*
1...4999
1...5000
*/
ll a = x/5000;
a++;
ll b = (x%5000==0)? 5000:x%5000;
ll c = ((a+b)%5000!=0)? (a+b)%5000:5000;
for (int i=1 ; i<=1666 ; i++)
{
if (i!=a and i!=b and i!=c) vp.push_back({i, a});
}
for (int i=1666+1 ; i<=1666*2 ; i++)
{
if (i!=a and i!=b and i!=c) vp.push_back({i, b});
}
for (int i=1666*2+1 ; i<=5000 ; i++)
{
if (i!=a and i!=b and i!=c) vp.push_back({i, c});
}
if (vp.size()<4999 and a!=b)
vp.push_back({a, b});
if (vp.size()<4999 and c!=b)
vp.push_back({c, b});
if (vp.size()<4999 and a!=c)
vp.push_back({a, c});
return vp;
}
//
// g++ Alice.cpp Bob.cpp grader.cpp -o a.exe
#include <vector>
#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
// 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){
map<ll,ll>frq;
set<ll>s;
for (auto it:V)
{
frq[it.first]++;
frq[it.second]++;
if (frq[it.first]>1)
s.insert(it.first);
if (frq[it.second]>1)
s.insert(it.second);
}
if (s.size()>10)
{
return 25000000;
}
ll a=-1, b=-1, c=-1;
for (auto it:V)
{
ll x = it.first, y = it.second;
if (s.find(x)==s.end())
{
if (x<=1666)
a = y;
else
{
if (x<=2*1666)
b = y;
else
c = y;
}
}
if (s.find(y)==s.end())
{
if (y<=1666)
a = x;
else
{
if (y<=2*1666)
b = x;
else
c = x;
}
}
}
// cout<<a<<" "<<b<<" "<<c<<endl;
if (a==-1) a = (c-b-1+5000)%5000+1;
if (b==-1) b = (c-a-1+5000)%5000+1;
// cout<<a<<" "<<b<<" "<<c<<endl;
return (a-1)*5000 + b%5000;
}//g++ Alice.cpp grader.cpp Bob.cpp -o a.exe