제출 #1191659

#제출 시각아이디문제언어결과실행 시간메모리
1191659Muhammad_Aneeq마술쇼 (APIO24_show)C++20
100 / 100
2 ms380 KiB
#include <vector> #include "Alice.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(). vector<pair<int,int>> Alice() { long long x = setN(5000); vector<pair<int,int>>ans; for (int i=1;i<5000;i++) { long long f=x%i; if (f==0) f=5000; ans.push_back({f,i}); } return ans; }
#include <vector> #include "Bob.h" #include <numeric> // 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(). using namespace std; long long mx=1e18; long long Bob(vector<pair<int,int>> V) { long long rem=1,md=1; for (auto [a,b]:V) { if (a==5000) a=0; if (b==5000) b=0; if (b>a) swap(a,b); while (rem%a!=b) rem+=md; long long gc=gcd(md,a); if (md/gc>mx/a) break; md=md/gc*a; } return rem; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...