Submission #1184545

#TimeUsernameProblemLanguageResultExecution timeMemory
1184545thieunguyenhuyMagic Show (APIO24_show)C++20
100 / 100
2 ms380 KiB
#include "Alice.h" #include <bits/stdc++.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(). std::vector<std::pair<int,int>> Alice(){ // add your code here // change below into your code int n = 5000; long long X = setN(n); vector<pair<int, int>> edges; for (int i = 2; i <= n; ++i) edges.emplace_back(X % (i - 1) + 1, i); return edges; }
#include "Bob.h" #include <bits/stdc++.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(). long long Bob(std::vector<std::pair<int,int>> V){ // add your code here long long X = 0, lcm = 1; for (auto &it : V) { int mod = it.second - 1; while (X % mod != it.first - 1) X += lcm; lcm = lcm / __gcd(lcm, 0ll + mod) * mod; } return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...