제출 #335353

#제출 시각아이디문제언어결과실행 시간메모리
335353blue곤돌라 (IOI14_gondola)C++11
컴파일 에러
0 ms0 KiB
#include "gondola.h" #include <iostream> using namespace std; int valid(int n, int inputSeq[]) { set<int> S; int temp = n+1; for(int i = 0; i < n; i++) if(inputSeq[i] <= n) { temp = inputSeq[i]; break; if(S.find(temp) != S.end()) return 0; S.insert(temp); } if(temp == n+1) return 1; for(int i = 0; i < n; i++) if(inputSeq[i] <= n) { inputSeq[i] = (inputSeq[i] - temp + n) % n; } temp = -1; for(int i = 0; i < n; i++) { if(inputSeq[i] > n) continue; if(temp != -1 && inputSeq[i] <= inputSeq[temp]) return 0; temp = i; } return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return 0; } int countReplacement(int n, int inputSeq[]) { return 0; }

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

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:7:5: error: 'set' was not declared in this scope
    7 |     set<int> S;
      |     ^~~
gondola.cpp:3:1: note: 'std::set' is defined in header '<set>'; did you forget to '#include <set>'?
    2 | #include <iostream>
  +++ |+#include <set>
    3 | using namespace std;
gondola.cpp:7:9: error: expected primary-expression before 'int'
    7 |     set<int> S;
      |         ^~~
gondola.cpp:13:12: error: 'S' was not declared in this scope
   13 |         if(S.find(temp) != S.end()) return 0;
      |            ^
gondola.cpp:14:9: error: 'S' was not declared in this scope
   14 |         S.insert(temp);
      |         ^