#include <vector>
#include "Bob.h"
#include <numeric>
// 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().
using namespace std;
long long mx=1e18;
long long Bob(vector<pair<int,int>> V)
{
long long rem=1,md=1;
for (auto [a,b]:V)
{
if (a==5000)
a=0;
if (b==5000)
b=0;
if (b>a)
swap(a,b);
while (rem%a!=b)
rem+=md;
long long gc=gcd(md,a);
if (md/gc>mx/a) break;
md=md/gc*a;
}
return rem;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |