Submission #1293609

#TimeUsernameProblemLanguageResultExecution timeMemory
1293609sh1kaMagic 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(77);
    vector<pair<int, int>> res;

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

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

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

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

long long Bob(vector<pair<int, int>> v) {
    long long ans = 0, d = 1;

    for (auto [r, a] : v) {
        while (ans % a != r)
            ans += d;
        d *= a / __gcd(a, d);
    }

    return ans;
}

Compilation message (stderr)

# 2번째 컴파일 단계

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:24:23: error: no matching function for call to '__gcd(std::tuple_element<1, std::pair<int, int> >::type&, long long int&)'
   24 |         d *= a / __gcd(a, d);
      |                  ~~~~~^~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from Bob.cpp:2:
/usr/include/c++/13/bits/stl_algo.h:1185:5: note: candidate: 'template<class _EuclideanRingElement> constexpr _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1185 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/13/bits/stl_algo.h:1185:5: note:   template argument deduction/substitution failed:
Bob.cpp:24:23: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('int' and 'long long int')
   24 |         d *= a / __gcd(a, d);
      |                  ~~~~~^~~~~~