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 <vector>
#include "Alice.h"
using namespace std;
vector<pair<int,int>> Alice(){
const int n = 5000;
long long x = setN(n);
vector<pair<int, int>> ret;
for(int i = 2; i <= n; i++) {
int p = (int)(x % (long long)(i - 1)) + 1;
ret.push_back(make_pair(p, i));
}
return ret;
}
#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
typedef long long i64;
typedef pair<i64, i64> pii;
#define ff first
#define ss second
#define MP make_pair
i64 gcd(i64 a, i64 b) { if(b == 0) return a; return gcd(b, a % b); }
i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
long long Bob(vector<pair<int,int>> v){
for(auto &p : v)
p.ss--;
pii p = v[0];
for(int i = 1; i < v.size(); i++) {
i64 r = v[i].ff;
i64 m = v[i].ss;
while(p.ff % m != r)
p.ff += p.ss;
p.ss = lcm(p.ss, m);
}
return p.ff;
}
Compilation message (stderr)
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
20 | for(int i = 1; i < v.size(); i++) {
| ~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |