제출 #236946

#제출 시각아이디문제언어결과실행 시간메모리
236946crossing0verGondola (IOI14_gondola)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "gondola.h" using namespace std; const int MAXN = 1E5+5; int n,a[MAXN]; int valid(int n1, int inputSeq[]) { n = n1; int pos = -1; for (int i = 0; i < n; i++) { a[i] = inputSeq[i]; if (a[i] <= n) pos = i; } if (pos != -1) { int x = (a[pos] - pos - 1)%n; if (x <0) x+= n; int b[MAXN]; for (int i = 0; i < n; i++) { b[(x + i)%n] = a[i]; } for (int i = 0;i < n; i++) a[i] = b[i]; } set<int> s; for (int i = 0; i < n; i++) { if (a[i] < n) { if (a[i] != i + 1) return 0; } s.insert(a[i]); } if (s.size() != n) return 0; return 1; } int replacement(int n, int gondolaSeq[], int replacementSeq[]); int countReplacement(int n, int inputSeq[]); /* main() { int n; cin >> n; int inputseq[n]; for (int i = 0;i < n; i++) cin >> inputseq[i]; cout << valid(n,inputseq); }*/

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

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:31:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if (s.size() != n) return 0;
      ~~~~~~~~~^~~~
/tmp/ccGxFXwV.o: In function `main':
grader.cpp:(.text.startup+0xc3): undefined reference to `countReplacement'
grader.cpp:(.text.startup+0x106): undefined reference to `replacement'
collect2: error: ld returned 1 exit status