This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
const int N = 500;
std::vector<std::pair<int,int>> Alice()
{
long long X = setN(N);
vector<pair<int ,int>> vp;
for(int i = 2 ; i <= N ; i++)
{
vp.push_back({X%(i - 1) + 1 , i});
}
return vp;
}
#include <bits/stdc++.h>
#include "Bob.h"
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().
const int N = 5000;
long long lcm(int a , int b)
{
return a * (b / __gcd(a , b));
}
long long Bob(std::vector<std::pair<int,int>> V)
{
long long ans = 0;
long long cur_mod = 1;
for(auto [r , mod] : V)
{
r-- , mod--;
while (ans % mod != r)
ans+=cur_mod;
cur_mod = lcm(cur_mod , mod);
if(cur_mod > (long long)1e18)
break;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |