제출 #1082731

#제출 시각아이디문제언어결과실행 시간메모리
1082731dong_gas마술쇼 (APIO24_show)C++17
컴파일 에러
0 ms0 KiB
#include <bits/extc++.h> #include "Alice.h" //#include "Bob.h" #define all(v) v.begin(), v.end() #define zip(v) sort(all(v)), v.erase(unique(all(v)), v.end()) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pint; typedef pair<ll, ll> pll; using namespace __gnu_pbds; template<class T> using PBDS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<class T> using multiPBDS = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; vector<pint> Alice(){ ll x = setN(5000); vector<pint> edges; for(int i=2;i<=5000;i++) edges.push_back({x%(i-1)+1,i}); return edges; }
#include <bits/extc++.h> //#include "Alice.h" #include "Bob.h" #define all(v) v.begin(), v.end() #define zip(v) sort(all(v)), v.erase(unique(all(v)), v.end()) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pint; typedef pair<ll, ll> pll; using namespace __gnu_pbds; template<class T> using PBDS = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<class T> using multiPBDS = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; ll Bob(vector<pint> edges){ ll ans=0, lc=1; for(auto& [u, v]:edges) { //v-1로 나눈 나머지가 u-1.. u--, v--; while(ans%v!=u) ans+=lc; lc=lc*v/__gcd(lc,v); } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

Bob.cpp: In function 'll Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:23:27: error: no matching function for call to '__gcd(ll&, std::tuple_element<1, std::pair<int, int> >::type&)'
   23 |         lc=lc*v/__gcd(lc,v);
      |                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/extc++.h:32,
                 from Bob.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:1219:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1219 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/10/bits/stl_algo.h:1219:5: note:   template argument deduction/substitution failed:
Bob.cpp:23:27: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   23 |         lc=lc*v/__gcd(lc,v);
      |                           ^