QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#746953#8726. Magic ShowKiharaToumaCompile Error//C++231.5kb2024-11-14 15:58:032024-11-14 15:58:07

Judging History

你现在查看的是最新测评结果

  • [2024-11-14 15:58:07]
  • 评测
  • [2024-11-14 15:58:03]
  • 提交

Alice

//qoj8726
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define ALICE
//#define BOB

#ifdef ALICE

#include "Alice.h"

std::vector<std::pair<int, int> > Alice(){
	vector<pair<int, int> > res;
	res.clear();
	ll val = setN(5000);
    for(int i = 2; i <= 5000; ++ i){
        res.emplace_back(val * (i-1) + 1, i);
    }
	return res;
}

#endif

#ifdef BOB

#include "Bob.h"

long long Bob(std::vector<std::pair<int, int>> V){
	ll res = 0, nw = 1;
	for(auto i : V){
        int x = i.first - 1, y = i.second - 1;
        while(res % y != x){
            res += nw;
        }
        nw = nw / __gcd(nw, y) * y;
        if(nw > 1e18){
            break;
        }
    }
	return res;
}

#endif

Bob

//qoj8726
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

//#define ALICE
#define BOB

#ifdef ALICE

#include "Alice.h"

std::vector<std::pair<int, int> > Alice(){
	vector<pair<int, int> > res;
	res.clear();
	ll val = setN(5000);
    for(int i = 2; i <= 5000; ++ i){
        res.emplace_back(val * (i-1) + 1, i);
    }
	return res;
}

#endif

#ifdef BOB

#include "Bob.h"

long long Bob(std::vector<std::pair<int, int>> V){
	ll res = 0, nw = 1;
	for(auto i : V){
        int x = i.first - 1, y = i.second - 1;
        while(res % y != x){
            res += nw;
        }
        nw = nw / __gcd(nw, y) * y;
        if(nw > 1e18){
            break;
        }
    }
	return res;
}

#endif

详细

Bob.code: In function ‘long long int Bob(std::vector<std::pair<int, int> >)’:
Bob.code:36:24: error: no matching function for call to ‘__gcd(ll&, int&)’
   36 |         nw = nw / __gcd(nw, y) * y;
      |                   ~~~~~^~~~~~~
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.code:2:
/usr/include/c++/13/bits/stl_algo.h:1185:5: note: candidate: ‘template<class _EuclideanRingElement> _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.code:36:24: note:   deduced conflicting types for parameter ‘_EuclideanRingElement’ (‘long long int’ and ‘int’)
   36 |         nw = nw / __gcd(nw, y) * y;
      |                   ~~~~~^~~~~~~