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 "Alice.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<std::pair<int,int>> Alice(){
long long x = setN(5000);
vector<pair<int,int>> haha(0);
for(int i = 2; i <= 5000; i++) {
haha.push_back({x%(i-1)+1,i});
}
return haha;
}
#include "Bob.h"
#include<bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
if(b == 0) {
return a;
}
return gcd(b,a%b);
}
long long lcm(long long a, long long b) {
return (a/gcd(a,b))*b;
}
long long Bob(std::vector<std::pair<int,int>> haha){
long long c = 1,ost = 0;
for(int i = 0; i < haha.size(); i++) {
int a = haha[i].first,b = haha[i].second;
if(a > b) {
swap(a,b);
}
while(ost%(b-1) != a-1) {
ost+=c;
}
c = lcm(c,b-1);
}
if(ost == 0) {
return c;
}
else {
return ost;
}
}
Compilation message (stderr)
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:18: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]
18 | for(int i = 0; i < haha.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... |