# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
994335 | tosivanmak | Magic Show (APIO24_show) | C++17 | 3 ms | 944 KiB |
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>
#define ll long long
using namespace std;
vector<pair<int, int>> Alice() {
ll x=setN(5000);
vector<pair<int,int> >edges;
for(int i=2;i<=5000;i++){
edges.push_back({i,x%(i-1)+1});
}
return edges;
}
#include <bits/stdc++.h>
#include "Bob.h"
#define ll long long
using namespace std;
long long Bob(vector<pair<int,int>> v) {
for(int i=0;i<v.size();i++){
v[i].first--,v[i].second--;
if(v[i].first<v[i].second){
swap(v[i].first,v[i].second);
}
}
sort(v.begin(),v.end());
ll val=-1,add;
for(int i=0;i<v.size();i++){
if(val==-1){val=v[i].second;add=v[i].first;}
else{
while(val%v[i].first!=v[i].second){
val+=add;
}
add=lcm(add,v[i].first);
}
}
return val;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |