답안 #1091796

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1091796 2024-09-22T07:15:57 Z sqrteipi Choreography (IOI23_choreography) C++17
컴파일 오류
0 ms 0 KB
#include "choreography.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> vec, pos(100005);
int sum = 0, n;
void init(int N, vector<int> P) {
    n = N;
    vec = P;
    for (int i=0; i<n; i++) pos[vec[i]] = i;
} 

void move_right(int K) {
    sum = (sum + K) % n;

void move_left(int K) {
    sum = (sum - K) % n;
    return;
}

void swap_places() {
    return;
}

void move_around() {
    return;
}

int get_position(int D){
    return (pos[D] + sum + n) % n;
}

Compilation message

choreography.cpp: In function 'void move_right(int)':
choreography.cpp:16:23: error: a function-definition is not allowed here before '{' token
   16 | void move_left(int K) {
      |                       ^
choreography.cpp:21:20: error: a function-definition is not allowed here before '{' token
   21 | void swap_places() {
      |                    ^
choreography.cpp:25:20: error: a function-definition is not allowed here before '{' token
   25 | void move_around() {
      |                    ^
choreography.cpp:29:24: error: a function-definition is not allowed here before '{' token
   29 | int get_position(int D){
      |                        ^
choreography.cpp:31:1: error: expected '}' at end of input
   31 | }
      | ^
choreography.cpp:13:24: note: to match this '{'
   13 | void move_right(int K) {
      |                        ^