Submission #1029896

# Submission time Handle Problem Language Result Execution time Memory
1029896 2024-07-21T13:31:59 Z lucri Magic Show (APIO24_show) C++17
35 / 100
3 ms 832 KB
#include <vector>
#include <utility>
long long setN(int n);
std::vector<std::pair<int,int>> Alice()
{
    std::vector<std::pair<int,int>>v;
    long long x=setN(5000);
    for(int i=2;i<=5000;++i)
        v.push_back({x%(i-1)+1,i});
    return v;
}
#include <vector>
#include <utility>
__int128 cmmdc(__int128 a,__int128 b,__int128 &x1,__int128 &x2)
{
    if(b==0)
    {
        x1=1;
        x2=0;
        return a;
    }
    __int128 val=cmmdc(b,a%b,x1,x2),cop;
    cop=x1;
    x1=x2;
    x2=cop-a/b*x2;
    return val;
}
long long Bob(std::vector<std::pair<int,int>> V)
{
    __int128 a=0,b=1,aa,bb;
    __int128 n=V.size();
    for(__int128 i=0;i<n;++i)
    {
        aa=V[i].first-1;
        bb=V[i].second-1;
        __int128 x1,x2;
        __int128 d=cmmdc(b,bb,x1,x2);
        a=a+x1*(aa-a)/d*b;
        b=b*bb/d;
        a%=b;
        if(a<=0)
            a+=b;
        if(b>1000000000000000000)
            return a;
    }
}

Compilation message

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:35:1: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 3 ms 820 KB Correct.
2 Correct 2 ms 820 KB Correct.
3 Correct 2 ms 820 KB Correct.
4 Correct 1 ms 820 KB Correct.
5 Correct 2 ms 816 KB Correct.
6 Correct 3 ms 820 KB Correct.
7 Correct 3 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 824 KB Correct.
10 Correct 2 ms 828 KB Correct.
11 Correct 3 ms 768 KB Correct.
12 Correct 2 ms 816 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 3 ms 820 KB Correct.
2 Correct 2 ms 820 KB Correct.
3 Correct 2 ms 820 KB Correct.
4 Correct 1 ms 820 KB Correct.
5 Correct 2 ms 816 KB Correct.
6 Correct 3 ms 820 KB Correct.
7 Correct 3 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 824 KB Correct.
10 Correct 2 ms 828 KB Correct.
11 Correct 3 ms 768 KB Correct.
12 Correct 2 ms 816 KB Correct.
13 Correct 1 ms 824 KB Correct.
14 Correct 1 ms 820 KB Correct.
15 Correct 2 ms 820 KB Correct.
16 Correct 2 ms 820 KB Correct.
17 Correct 2 ms 820 KB Correct.
18 Correct 2 ms 820 KB Correct.
19 Correct 1 ms 820 KB Correct.
20 Correct 1 ms 820 KB Correct.
21 Correct 2 ms 820 KB Correct.
22 Correct 1 ms 820 KB Correct.
23 Correct 3 ms 820 KB Correct.
24 Correct 1 ms 820 KB Correct.
# Verdict Execution time Memory Grader output
1 Correct 3 ms 820 KB Correct.
2 Correct 2 ms 820 KB Correct.
3 Correct 2 ms 820 KB Correct.
4 Correct 1 ms 820 KB Correct.
5 Correct 2 ms 816 KB Correct.
6 Correct 3 ms 820 KB Correct.
7 Correct 3 ms 820 KB Correct.
8 Correct 1 ms 820 KB Correct.
9 Correct 1 ms 824 KB Correct.
10 Correct 2 ms 828 KB Correct.
11 Correct 3 ms 768 KB Correct.
12 Correct 2 ms 816 KB Correct.
13 Correct 1 ms 824 KB Correct.
14 Correct 1 ms 820 KB Correct.
15 Correct 2 ms 820 KB Correct.
16 Correct 2 ms 820 KB Correct.
17 Correct 2 ms 820 KB Correct.
18 Correct 2 ms 820 KB Correct.
19 Correct 1 ms 820 KB Correct.
20 Correct 1 ms 820 KB Correct.
21 Correct 2 ms 820 KB Correct.
22 Correct 1 ms 820 KB Correct.
23 Correct 3 ms 820 KB Correct.
24 Correct 1 ms 820 KB Correct.
25 Correct 2 ms 820 KB Correct.
26 Correct 3 ms 740 KB Correct.
27 Correct 2 ms 820 KB Correct.
28 Correct 2 ms 832 KB Correct.
29 Correct 2 ms 824 KB Correct.
30 Incorrect 1 ms 792 KB Incorrect answer.
31 Halted 0 ms 0 KB -