Submission #1029895

# Submission time Handle Problem Language Result Execution time Memory
1029895 2024-07-21T13:31:41 Z lucri Magic Show (APIO24_show) C++17
Compilation error
0 ms 0 KB
#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;
    }
}
#include <vector>
#include <utility>
long long cmmdc(long long a,long long b,long long &x1,long long &x2)
{
    if(b==0)
    {
        x1=1;
        x2=0;
        return a;
    }
    long long 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;
    int n=V.size();
    for(int i=0;i<n;++i)
    {
        aa=V[i].first-1;
        bb=V[i].second-1;
        long long x1,x2;
        long long 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

Alice.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Alice.cpp:35:1: warning: control reaches end of non-void function [-Wreturn-type]
   35 | }
      | ^
/usr/bin/ld: /tmp/cc2MsHt1.o: in function `main':
grader_alice.cpp:(.text.startup+0x110): undefined reference to `Alice()'
collect2: error: ld returned 1 exit status

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 | }
      | ^