Submission #1016305

#TimeUsernameProblemLanguageResultExecution timeMemory
1016305amine_arouaMagic Show (APIO24_show)C++17
100 / 100
1 ms784 KiB
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
const int N = 500;
std::vector<std::pair<int,int>> Alice()
{
    long long X = setN(N);
    vector<pair<int ,int>> vp;
    for(int i = 2 ; i <= N ; i++)
    {
        vp.push_back({X%(i - 1) + 1 , i});
    }
    return vp;
}
#include <bits/stdc++.h>
#include "Bob.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().
const int N = 5000;
long long lcm(int a , int b)
{
    return a * (b / __gcd(a , b));
}
long long Bob(std::vector<std::pair<int,int>> V)
{
    long long ans = 0;
    long long cur_mod = 1;
    for(auto [r , mod] : V)
    {
        r-- , mod--;
        while (ans % mod != r)
            ans+=cur_mod;
        cur_mod = lcm(cur_mod , mod);
        if(cur_mod > (long long)1e18)
            break;
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...