답안 #843643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
843643 2023-09-04T10:35:47 Z heavylightdecomp Choreography (IOI23_choreography) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5+5;
#define int long long
int x[maxn], y[maxn], s, t, N;
void init(int n, vector<int> p) {
    N = n;
    for(int i = 0; i < N; i++) {
        x[i] = p[i]; // x to y
        y[p[i]] = i; // y to x
    }
}
int fix(int c) {
    c += maxn * N;
    return c % N;
    
}
void move_right(int K) {
    s += K;
}
void move_left(int K) {
    s -= K;
}
void swap_places() {
    
}
void move_around() {
    swap(x,y);
    swap(s,t);
}

int get_position(int D) {
    /*
    Careful! 
    x[i] represents p[i+s mod N]
    x[i-s mod N] represents p[i], the intended value
    same for y
    */

   return fix(y[fix(D-t)] + s);

}

Compilation message

/usr/bin/ld: /tmp/ccur8W28.o: in function `main':
grader.cpp:(.text.startup+0x40e): undefined reference to `init(int, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x461): undefined reference to `get_position(int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x589): undefined reference to `move_right(int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x599): undefined reference to `move_left(int)'
collect2: error: ld returned 1 exit status