Submission #1125255

#TimeUsernameProblemLanguageResultExecution timeMemory
1125255biankMachine (IOI24_machine)C++20
Compilation error
0 ms0 KiB
#include "machine.h"

using namespace std;

vector<int> find_permutation(int N) {
    vector<int> A(N);
    for (int i = 1; i < N; i++) A[i - 1] = i;
    A[N - 1] = N + 2;
    vector<int> B = use_machine(A);
    for (int X = 0; X < 256; X++) {
        vector<int> cnt(N, 0);
        vector<int> P(N, 0);
        bool flag = true;
        for (int i = 0; i < N; i++) {
            int AP = B[i] ^ X;
            if (1 <= AP && AP < N) P[i] = AP - 1;
            else if (AP == N + 2) P[i] = N - 1;
            else flag = false;
            if (++cnt[P[i]] != 1) flag = false;
        }
        if (flag) return P;
    }
    assert(false);
}

Compilation message (stderr)

machine.cpp: In function 'std::vector<int> find_permutation(int)':
machine.cpp:23:5: error: 'assert' was not declared in this scope
   23 |     assert(false);
      |     ^~~~~~
machine.cpp:2:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
    1 | #include "machine.h"
  +++ |+#include <cassert>
    2 | 
machine.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^