QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#915073#2810. Speedrunjiangly (Lingyu Jiang)Compile Error//C++231.8kb2025-02-25 20:47:542025-02-25 20:47:55

Judging History

This is the latest submission verdict.

  • [2025-02-25 20:47:55]
  • Judged
  • [2025-02-25 20:47:54]
  • Submitted

speedrun

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

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

void assignHints(int subtask, int N, int A[], int B[]) {
    std::vector<std::vector<int>> adj(N + 1);
    for (int i = 1; i < N; i++) {
        adj[A[i]].push_back(B[i]);
        adj[B[i]].push_back(A[i]);
    }
    
    setHintLen(20);
    
    std::vector<int> ord;
    std::vector<int> p(N + 1);
    auto dfs = [&](this auto &&self, int x) -> void {
        ord.push_back(x);
        for (auto y : adj[x]) {
            if (y == p[x]) {
                continue;
            }
            p[y] = x;
            self(y);
        }
    };
    dfs(1);
    
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= 10; j++) {
            setHint(i, j, p[i] >> (j - 1) & 1);
        }
        if (i < N) {
            int x = ord[i - 1], y = ord[i];
            for (int j = 1; j <= 10; j++) {
                setHint(x, 10 + j, y >> (j - 1) & 1);
            }
        }
    }
}

void speedrun(int subtask, int N, int start) {
    int x = start;
    while (x != 1) {
        int p = 0;
        for (int j = 1; j <= 10; j++) {
            p |= getHint(j) << (j - 1);
        }
        assert(goTo(p));
        x = p;
    }
    
    std::vector<int> stk {x};
    int nxt = 0;
    for (int j = 1; j <= 10; j++) {
        nxt |= getHint(10 + j) << (j - 1);
    }
    while (nxt) {
        if (goTo(nxt)) {
            stk.push_back(nxt);
            nxt = 0;
            for (int j = 1; j <= 10; j++) {
                nxt |= getHint(10 + j) << (j - 1);
            }
        } else {
            stk.pop_back();
            assert(goTo(stk.back()));
        }
    }
}

Details

speedrun.code:4:7: error: expected nested-name-specifier before ‘i64’
    4 | using i64 = long long;
      |       ^~~
speedrun.code:5:7: error: expected nested-name-specifier before ‘u64’
    5 | using u64 = unsigned long long;
      |       ^~~
speedrun.code:6:7: error: expected nested-name-specifier before ‘u32’
    6 | using u32 = unsigned;
      |       ^~~
speedrun.code:7:7: error: expected nested-name-specifier before ‘u128’
    7 | using u128 = unsigned __int128;
      |       ^~~~
speedrun.code:8:7: error: expected nested-name-specifier before ‘i128’
    8 | using i128 = __int128;
      |       ^~~~
speedrun.code: In function ‘void assignHints(int, int, int*, int*)’:
speedrun.code:11:32: error: ‘>>’ should be ‘> >’ within a nested template argument list
   11 |     std::vector<std::vector<int>> adj(N + 1);
      |                                ^~
      |                                > >
speedrun.code:21:10: error: ‘dfs’ does not name a type; did you mean ‘ffs’?
   21 |     auto dfs = [&](this auto &&self, int x) -> void {
      |          ^~~
      |          ffs
speedrun.code:31:5: error: ‘dfs’ was not declared in this scope; did you mean ‘ffs’?
   31 |     dfs(1);
      |     ^~~
      |     ffs
speedrun.code: In function ‘void speedrun(int, int, int)’:
speedrun.code:57:26: warning: extended initializer lists only available with ‘-std=c++11’ or ‘-std=gnu++11’
   57 |     std::vector<int> stk {x};
      |                          ^
speedrun.code:57:22: error: in C++98 ‘stk’ must be initialized by constructor, not by ‘{...}’
   57 |     std::vector<int> stk {x};
      |                      ^~~
grader_speedrun.cpp: In function ‘int readvalue()’:
grader_speedrun.cpp:9:9: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   fscanf(input, "%d", &val);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~