QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#521051#8726. Magic ShowMisty7Compile Error//C++14804b2024-08-15 20:29:352024-08-15 20:29:36

Judging History

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

  • [2024-08-15 20:29:36]
  • 评测
  • [2024-08-15 20:29:35]
  • 提交

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;
}

i64 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;
}

详细

Bob.code: In function ‘i64 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