Submission #1016305

# Submission time Handle Problem Language Result Execution time Memory
1016305 2024-07-07T18:15:45 Z amine_aroua Magic Show (APIO24_show) C++17
100 / 100
1 ms 784 KB
#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 time Memory Grader output
1 Correct 0 ms 776 KB Correct.
2 Correct 0 ms 776 KB Correct.
3 Correct 0 ms 776 KB Correct.
4 Correct 0 ms 776 KB Correct.
5 Correct 0 ms 776 KB Correct.
6 Correct 0 ms 784 KB Correct.
7 Correct 1 ms 776 KB Correct.
8 Correct 0 ms 776 KB Correct.
9 Correct 0 ms 784 KB Correct.
10 Correct 0 ms 776 KB Correct.
11 Correct 0 ms 776 KB Correct.
12 Correct 0 ms 784 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 0 ms 776 KB Correct.
2 Correct 0 ms 776 KB Correct.
3 Correct 0 ms 776 KB Correct.
4 Correct 0 ms 776 KB Correct.
5 Correct 0 ms 776 KB Correct.
6 Correct 0 ms 784 KB Correct.
7 Correct 1 ms 776 KB Correct.
8 Correct 0 ms 776 KB Correct.
9 Correct 0 ms 784 KB Correct.
10 Correct 0 ms 776 KB Correct.
11 Correct 0 ms 776 KB Correct.
12 Correct 0 ms 784 KB Correct.
13 Correct 1 ms 776 KB Correct.
14 Correct 0 ms 784 KB Correct.
15 Correct 0 ms 784 KB Correct.
16 Correct 0 ms 784 KB Correct.
17 Correct 0 ms 776 KB Correct.
18 Correct 1 ms 776 KB Correct.
19 Correct 0 ms 776 KB Correct.
20 Correct 1 ms 776 KB Correct.
21 Correct 1 ms 776 KB Correct.
22 Correct 0 ms 776 KB Correct.
23 Correct 0 ms 776 KB Correct.
24 Correct 0 ms 776 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 0 ms 776 KB Correct.
2 Correct 0 ms 776 KB Correct.
3 Correct 0 ms 776 KB Correct.
4 Correct 0 ms 776 KB Correct.
5 Correct 0 ms 776 KB Correct.
6 Correct 0 ms 784 KB Correct.
7 Correct 1 ms 776 KB Correct.
8 Correct 0 ms 776 KB Correct.
9 Correct 0 ms 784 KB Correct.
10 Correct 0 ms 776 KB Correct.
11 Correct 0 ms 776 KB Correct.
12 Correct 0 ms 784 KB Correct.
13 Correct 1 ms 776 KB Correct.
14 Correct 0 ms 784 KB Correct.
15 Correct 0 ms 784 KB Correct.
16 Correct 0 ms 784 KB Correct.
17 Correct 0 ms 776 KB Correct.
18 Correct 1 ms 776 KB Correct.
19 Correct 0 ms 776 KB Correct.
20 Correct 1 ms 776 KB Correct.
21 Correct 1 ms 776 KB Correct.
22 Correct 0 ms 776 KB Correct.
23 Correct 0 ms 776 KB Correct.
24 Correct 0 ms 776 KB Correct.
25 Correct 0 ms 776 KB Correct.
26 Correct 0 ms 776 KB Correct.
27 Correct 1 ms 772 KB Correct.
28 Correct 0 ms 776 KB Correct.
29 Correct 0 ms 776 KB Correct.
30 Correct 0 ms 776 KB Correct.
31 Correct 0 ms 776 KB Correct.
32 Correct 1 ms 776 KB Correct.
33 Correct 0 ms 776 KB Correct.
34 Correct 0 ms 784 KB Correct.
35 Correct 0 ms 776 KB Correct.
36 Correct 0 ms 784 KB Correct.
37 Correct 0 ms 776 KB Correct.
38 Correct 1 ms 784 KB Correct.
39 Correct 0 ms 776 KB Correct.
40 Correct 1 ms 776 KB Correct.
41 Correct 0 ms 776 KB Correct.
42 Correct 0 ms 784 KB Correct.
43 Correct 0 ms 784 KB Correct.
44 Correct 0 ms 772 KB Correct.