QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#463485#8726. Magic ShowXZC0920Compile Error//C++141.0kb2024-07-04 21:45:562024-07-04 21:45:56

Judging History

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

  • [2024-07-04 21:45:56]
  • 评测
  • [2024-07-04 21:45:56]
  • 提交

Alice

#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
typedef int64_t i64;
vector<pair<int, int>> Alice()
{
    int n = 5000; i64 x = setN(n);
    vector<pair<int, int>> ans(n - 1);
    for(int i = 1; i < n; i++) ans[i - 1] = make_pair(i + 1, x % i + 1);
    return ans;
}

Bob

#include <bits/stdc++.h>
#include "Bob.h"
using namespace std;
typedef int64_t i64;
typedef __int128_t i128;
const i64 I = 1e18;
i64 gcd(i64 a, i64 b) {return b ? gcd(b, a % b) : a;}
i64 x, y;
i64 exgcd(i64 a, i64 b, i64 &x, i64 &y) 
{
    if(b == 0) return x = 1, y = 0, a;
    i64 d = exgcd(b, a % b, y, x);
    return y -= (a / b) * x, d;
}
i64 Bob(vector<pair<int, int>> e) 
{
    i64 a = 1, b = 0; 
    for(auto u: e) 
    {
        i64 b2 = u.first - 1, a2 = u.second - 1;
        i64 d = exgcd(a, a2, x, y);
        i128 a3 = (i128)a * a2 / d, b3 = ((i128)x * ((b2 - b) / d) * a + b) % a3;
        if(b3 < 0) b3 += a3;
        if(a3 > I) {b = b3; break;}
        a = a3, b = b3;
    }
    return b;
} 

Details

Bob.code:15:5: error: ambiguating new declaration of ‘i64 Bob(std::vector<std::pair<int, int> >)’
   15 | i64 Bob(vector<pair<int, int>> e)
      |     ^~~
In file included from Bob.code:2:
Bob.h:3:11: note: old declaration ‘long long int Bob(std::vector<std::pair<int, int> >)’
    3 | long long Bob(std::vector<std::pair<int,int>> V);
      |           ^~~