Submission #1200582

#TimeUsernameProblemLanguageResultExecution timeMemory
1200582boclobanchatMagic Show (APIO24_show)C++20
Compilation error
0 ms0 KiB
#include<vector>
#include"Alice.h"
using namespace std;
vector< pair<int,int> > Alice()
{
    long long x=setN(5000)+2043545791009887847;
    vector< pair<int,int> > edges;
    for(int i=1;i<5000;i++) edges.push_back({x%i+1,i+1});
	return edges;
}
#include<vector>
#include"Bob.h"
using namespace std;
int pre[5005],md[5005],mx[5005];
long long Bob(vector< pair<int,int> > V)
{
	for(int i=1;i<=5000;i++) pre[i]=i,mx[i]=1;
	for(int i=2;i<=5000;i++) if(pre[i]==i) for(int j=i;j<=5000;j+=i) pre[j]=min(pre[j],i);
	for(auto v:V)
	{
		int x=v.first-1,y=v.second-1;
		while(y>1)
		{
			int p=pre[y],res=1;
			while(y%p==0) y/=p,res*=p;
			if(mx[p]<res) mx[p]=res,md[p]=x%res;
		}
	}
	long long ans=0,lc=1;
	for(int i=1;i<=5000;i++) if(ans%mx[i]!=md[i])
	{
		while(ans%mx[i]!=md[i]) ans+=lc;
		lc=lc/__gcd(lc,mx[i])*mx[i];
	}
	return ans-2043545791009887847;
}

Compilation message (stderr)

# 2번째 컴파일 단계

Bob.cpp: In function 'long long int Bob(std::vector<std::pair<int, int> >)':
Bob.cpp:23:28: error: no matching function for call to '__gcd(long long int&, int&)'
   23 |                 lc=lc/__gcd(lc,mx[i])*mx[i];
      |                       ~~~~~^~~~~~~~~~
In file included from /usr/include/c++/11/vector:62,
                 from Bob.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:1199:5: note: candidate: 'template<class _EuclideanRingElement> constexpr _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:23:28: note:   deduced conflicting types for parameter '_EuclideanRingElement' ('long long int' and 'int')
   23 |                 lc=lc/__gcd(lc,mx[i])*mx[i];
      |                       ~~~~~^~~~~~~~~~