QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#521050#8726. Magic ShowMisty7Compile Error//C++14804b2024-08-15 20:28:502024-08-15 20:28:51

Judging History

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

  • [2024-08-15 20:28:51]
  • 评测
  • [2024-08-15 20:28:50]
  • 提交

Alice

#include <bits/stdc++.h>
#include "Alice.h"

using i64 = long long;

constexpr int N = 5000;

std::vector<std::pair<int, int>> Alice () {
    i64 n = setN(N);
    std::vector<std::pair<int, int>> edges;
    for (int i = 1; i < n; i++) {
        edges.emplace_back(n % i + 1, i + 1);
    }
    return edges;
}

Bob

#include <bits/stdc++.h>
#include "Bob.h"

using i64 = long long;

constexpr i64 limit = 1E15;

i64 lcm (i64 a, i64 b) {
    return a / std::__gcd(a, b) * b;
}

int Bob (std::vector<std::pair<int, int>> edges) {
    i64 ans = 0, per = 0;
    for (auto [x, y] : edges) {
        x--, y--;
        while (ans % x != y) {
            ans += per;
        }
        per = lcm(per, y);
        if (per >= lim) {
            break;
        }
    }
    return ans;
}

Details

Bob.code:12:5: error: ambiguating new declaration of ‘int Bob(std::vector<std::pair<int, int> >)’
   12 | int Bob (std::vector<std::pair<int, int>> edges) {
      |     ^~~
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);
      |           ^~~
Bob.code: In function ‘int Bob(std::vector<std::pair<int, int> >)’:
Bob.code:20:20: error: ‘lim’ was not declared in this scope; did you mean ‘lcm’?
   20 |         if (per >= lim) {
      |                    ^~~
      |                    lcm