제출 #229325

#제출 시각아이디문제언어결과실행 시간메모리
229325osaaateiasavtnl곤돌라 (IOI14_gondola)C++14
컴파일 에러
0 ms0 KiB
#include "gondola.h" int valid(int n, int a[]) { set <int> ms; for (int i = 0; i < n; ++i) ms.insert(a[i]); if (ms.size() < n) return 0; int pos = -1; for (int i = 0; i < n; ++i) { if (a[i] <= n) { pos = i; break; } } if (pos == -1) return 1; else { for (int sh = 0; sh < n; ++sh) { int i = (pos + sh) % n; int val = a[pos] + sh; if (val > n) val -= n; if (a[i] <= n && a[i] != val) return 0; } return 1; } } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

컴파일 시 표준 에러 (stderr) 메시지

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:5:5: error: 'set' was not declared in this scope
     set <int> ms;
     ^~~
gondola.cpp:5:10: error: expected primary-expression before 'int'
     set <int> ms;
          ^~~
gondola.cpp:7:9: error: 'ms' was not declared in this scope
         ms.insert(a[i]);
         ^~
gondola.cpp:8:9: error: 'ms' was not declared in this scope
     if (ms.size() < n)
         ^~