Submission #840371

#TimeUsernameProblemLanguageResultExecution timeMemory
840371heavylightdecompChoreography (IOI23_choreography)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
int orz[maxn], delt[maxn], N, ch;
void init(int n, int[] p) {
    N = n;
    for(int i = 0; i < N; i++) {
        orz[p[i]] = i;
    }
    for(int i = 0; i < N; i++) delt[i] = i;
}
void move_right(int K) {
    ch += K;
}
void move_left(int K) {
    ch += -K;
}
void swap_places() {

}
void move_around() {

}
int get_position(int D) {
    int pos = delt[orz[D]] + ch;
    while(pos >= n) {
        pos -= n;
    }
    while(pos < 0) {
        pos += n;
    }
    return pos;
}

Compilation message (stderr)

choreography.cpp:5:24: error: expected ',' or '...' before 'p'
    5 | void init(int n, int[] p) {
      |                        ^
choreography.cpp: In function 'void init(int, int*)':
choreography.cpp:8:13: error: 'p' was not declared in this scope
    8 |         orz[p[i]] = i;
      |             ^
choreography.cpp: In function 'int get_position(int)':
choreography.cpp:26:18: error: 'n' was not declared in this scope
   26 |     while(pos >= n) {
      |                  ^
choreography.cpp:30:16: error: 'n' was not declared in this scope
   30 |         pos += n;
      |                ^