제출 #1125189

#제출 시각아이디문제언어결과실행 시간메모리
1125189AlgorithmWarrior마술쇼 (APIO24_show)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "Alice.h" using namespace std; vector<pair<int,int>>Alice(){ long long x=setN(5000); int i; vector<pair<int,int>>tree; for(i=2;i<=5000;++i){ tree.push_back({x%(i-1)+1,i}); } return tree; }
#include <bits/stdc++.h> #include "Bob.h" using namespace std; __int128 bin_exp(__int128 base,__int128 exp,__int128 mod){ __int128 rez=1; while(exp){ if(exp&1){ rez=rez*base%mod; } base=base*base%mod; exp/=2; } return rez; } __int128 CRT(__int128 r1,__int128 m1,__int128 r2,__int128 m2){ __int128 g=__gcd(m1,m2); __int128 x,k; if(r2>=r1){ k=(r2-r1)/g%(m2/g)*bin_exp(m1/g,m2/g-2,m2/g)%(m2/g); x=m1*k+r1; } else{ k=(r1-r2)/g%(m1/g)*bin_exp(m2/g,m1/g-2,m1/g)%(m1/g); x=m2*k+r2; } return x; } long long Bob(vector<pair<int,int>>V){ __int128 x=0; __int128 mod=1; for(auto edge : V){ x=CRT(x,mod,edge.first-1,edge.second-1); if(mod>1e18/(1LL*edge.second-1)*__gcd(mod,1LL*edge.second-1)) break; mod=mod/__gcd(mod,1LL*edge.second-1)*(edge.second-1); } return x; }

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

# 2번째 컴파일 단계

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:37:46: error: no matching function for call to '__gcd(__int128&, long long int)'
   37 |         if(mod>1e18/(1LL*edge.second-1)*__gcd(mod,1LL*edge.second-1))
      |                                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Bob.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:1199:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1199 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/11/bits/stl_algo.h:1199:5: note:   template argument deduction/substitution failed:
Bob.cpp:37:46: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('__int128' and 'long long int')
   37 |         if(mod>1e18/(1LL*edge.second-1)*__gcd(mod,1LL*edge.second-1))
      |                                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Bob.cpp:39:22: error: no matching function for call to '__gcd(__int128&, long long int)'
   39 |         mod=mod/__gcd(mod,1LL*edge.second-1)*(edge.second-1);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from Bob.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:1199:5: note: candidate: 'template<class _EuclideanRingElement> _EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement)'
 1199 |     __gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
      |     ^~~~~
/usr/include/c++/11/bits/stl_algo.h:1199:5: note:   template argument deduction/substitution failed:
Bob.cpp:39:22: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('__int128' and 'long long int')
   39 |         mod=mod/__gcd(mod,1LL*edge.second-1)*(edge.second-1);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~