QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#889656#10071. Horaucup-team004Compile Error//C++23879b2025-02-08 17:08:212025-02-08 17:08:21

Judging History

This is the latest submission verdict.

  • [2025-02-08 17:08:21]
  • Judged
  • [2025-02-08 17:08:21]
  • Submitted

answer

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

using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;

int query(int L, int R) {
    int res = ask(L, R);
    int len = (R - L + N) % N + 1;
    return res * 2 - len;
}

int solve(int N, int K) {
    if (2 * K == N) {
        int lo = 0, hi = K;
        int a = query(0, K - 1);
        int b = -a;
        if (std::abs(a) <= 1) {
            return 0;
        }
        while (true) {
            int m = (lo + hi) / 2;
            int c = query(m, (m + K - 1) % N);
            if (std::abs(c) <= 1) {
                return m;
            }
            if ((a > 0) != (c > 0)) {
                b = c;
                hi = m;
            } else {
                a = c;
                lo = m;
            }
        }
    }
    return 0;
}

详细

answer.code: In function ‘int query(int, int)’:
answer.code:11:24: error: ‘N’ was not declared in this scope
   11 |     int len = (R - L + N) % N + 1;
      |                        ^