Submission #1017908

#TimeUsernameProblemLanguageResultExecution timeMemory
1017908nickolasarapidisChoreography (IOI23_choreography)C++17
Compilation error
0 ms0 KiB
#include "choreography.h" #include <bits/stdc++.h> using namespace std; #define ll long long map<int, int> m; vector<int> A; void move_right(int K){ int N = A.size(); K = K%N; vector<int> B(N); int d = 0; for(int i = 0; i < K; i++){ B[d] = A[i]; d++; } for(int i = K; i < N; i++){ B[d] = A[i]; d++; } for(int i = 0; i < N; i++){ A[i] = B[i]; m[A[i]] = i; } } void move_left(int K){ int N = A.size(); K = K%N; vector<int> B(N); int d = 0; for(int i = K; i < N; i++){ B[d] = A[i]; d++; } for(int i = 0; i < K; i++){ B[d] = A[i]; d++; } for(int i = 0; i < N; i++){ A[i] = B[i]; m[A[i]] = i; } } void swap_places(){ for(int i = 0; i < N/2 - 1; i++){ swap(A[2*i], A[2*i + 1]); } for(int i = 0; i < N; i++){ m[A[i]] = i; } } void move_around(){ int N = A.size(); vector<int> B(N); for(int i = 0; i < N - 1; i++){ B[A[i]] = i; } for(int i = 0; i < N; i++){ A[i] = B[i]; } } int get_position(int D){ return m[D]; } void init(int N, vector<int> P){ for(int i = 0; i < N; i++){ m[P[i]] = i; } A = P; }

Compilation message (stderr)

choreography.cpp: In function 'void swap_places()':
choreography.cpp:62:21: error: 'N' was not declared in this scope
   62 |  for(int i = 0; i < N/2 - 1; i++){
      |                     ^
choreography.cpp:66:21: error: 'N' was not declared in this scope
   66 |  for(int i = 0; i < N; i++){
      |                     ^