QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#149044#5156. Going in CirclesLaStataleBlue#Compile Error//C++201.3kb2023-08-23 23:09:222023-08-23 23:09:23

Judging History

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

  • [2023-08-23 23:09:23]
  • 评测
  • [2023-08-23 23:09:22]
  • 提交

answer

#pragma ide diagnostic ignored "misc-no-recursion"

#include "bits/stdc++.h"

using namespace std;
typedef long long ll;
typedef double db;

#define TESTCASE 0

static constexpr int MOD = 998'244'353;
static constexpr int INF = 1e9;

static int read() {
    int x;
    cin >> x;
    return x;
}

static int move() {
    cout << "? right" << endl;
    return read();
}

static int flip() {
    cout << "? flip" << endl;
    return read();
}

static void solve([[maybe_unused]] int tc) {
    read();

    mt19937_64 rng(3202916311594768294ll);
    bitset<64> signature = rng();

    bitset<64> B = 0;
    for (int n = 0; ; n++) {

        int x = move();
        B >>= 1;
        B.set(63, x);

        if (n < 64 && signature[n] != x) {
            flip();
        }

        if (signature == B) {
            cout << "! " << (n - 63) << endl;
            return;
        }
    }
}

int main() {
    ios::sync_with_stdio(false);

    for (int i = 0; i < N; i++) {
        values[i] = rand() % 2;
    }

    if (const char *f = getenv("REDIRECT_STDOUT"); f) {
        freopen(f, "w", stdout);
    }

    int T = 1;
#if TESTCASE
    cin >> T;
#endif

    for (int t = 1; t <= T; t++) {
        solve(t);
    }

    return 0;
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:57:25: error: ‘N’ was not declared in this scope
   57 |     for (int i = 0; i < N; i++) {
      |                         ^
answer.code:58:9: error: ‘values’ was not declared in this scope; did you mean ‘std::ranges::views::values’?
   58 |         values[i] = rand() % 2;
      |         ^~~~~~
      |         std::ranges::views::values
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:146,
                 from answer.code:3:
/usr/include/c++/11/ranges:3680:27: note: ‘std::ranges::views::values’ declared here
 3680 |     inline constexpr auto values = elements<1>;
      |                           ^~~~~~
answer.code:62:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   62 |         freopen(f, "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~