Submission #1293572

#TimeUsernameProblemLanguageResultExecution timeMemory
1293572sh1kaMagic Show (APIO24_show)C++20
Compilation error
0 ms0 KiB
#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;


vector<pair<int, int>> Alice() {
    // #define int int64_t
    long long X = setN(5000);
    vector<pair<int, int>> res;

    for (int64_t i = 1; i < 5000; i++) {
        res.push_back({X%i + 1, i + 1});
    }

    return res;
}
#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;

int gcd_r(int a, int b, int &x, int &y) {
    if (b == 0) {
        x = 1, y = 0;
        return a;
    }

    int g = gcd(b, a%b, x, y);
    int xp = y;
    int yp = x - y * (a / b);
    x = xp, y = yp;
    return g;
}

long long Bob(vector<pair<__int128_t, __int128_t>> v) {
    
    while (v.size() >= 2) {
        auto [r1, a1] = v.back();
        v.pop_back();
        auto [r2, a2] = v.back();
        v.pop_back();

        int gg = __gcd(a1, a2);
        a1 /= gg;
        a2 /= gg;

        r1 %= a1;
        r2 %= a2;

        int x, y;
        gg = gcd(a1, a2, x, y);
        y *= -1;
        x *= r2 - r1;
        y *= r2 - r1;

        v.push_back({a1 * x + r1, a1 * a2});
    }

    return v.back().first();
}

Compilation message (stderr)

# 2번째 컴파일 단계

Bob.cpp: In function 'int gcd_r(int, int, int&, int&)':
Bob.cpp:11:16: error: no matching function for call to 'gcd(int&, int, int&, int&)'
   11 |     int g = gcd(b, a%b, x, y);
      |             ~~~^~~~~~~~~~~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:58,
                 from Bob.cpp:2:
/usr/include/c++/13/numeric:164:5: note: candidate: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Tp1, _Tp2> std::gcd(_Mn, _Nn)'
  164 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
/usr/include/c++/13/numeric:164:5: note:   template argument deduction/substitution failed:
Bob.cpp:11:16: note:   candidate expects 2 arguments, 4 provided
   11 |     int g = gcd(b, a%b, x, y);
      |             ~~~^~~~~~~~~~~~~~
Bob.cpp: In function 'long long int Bob(std::vector<std::pair<__int128, __int128> >)':
Bob.cpp:34:17: error: no matching function for call to 'gcd(std::tuple_element<1, std::pair<__int128, __int128> >::type&, std::tuple_element<1, std::pair<__int128, __int128> >::type&, int&, int&)'
   34 |         gg = gcd(a1, a2, x, y);
      |              ~~~^~~~~~~~~~~~~~
/usr/include/c++/13/numeric:164:5: note: candidate: 'template<class _Mn, class _Nn> constexpr std::common_type_t<_Tp1, _Tp2> std::gcd(_Mn, _Nn)'
  164 |     gcd(_Mn __m, _Nn __n) noexcept
      |     ^~~
/usr/include/c++/13/numeric:164:5: note:   template argument deduction/substitution failed:
Bob.cpp:34:17: note:   candidate expects 2 arguments, 4 provided
   34 |         gg = gcd(a1, a2, x, y);
      |              ~~~^~~~~~~~~~~~~~
Bob.cpp:42:26: error: expression cannot be used as a function
   42 |     return v.back().first();
      |            ~~~~~~~~~~~~~~^~