제출 #411942

#제출 시각아이디문제언어결과실행 시간메모리
411942losmi247곤돌라 (IOI14_gondola)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e5+34; int n,a[N]; int pos[N],bio[3*N]; int valid(int br,vector <int> inputseq){ n = br; for(int i = 1; i <= n; i++) a[i] = inputseq[i-1]; for(int i = 1; i <= n; i++){ if(a[i] <= n) pos[a[i]] = i; if(bio[a[i]]) return 0; bio[a[i]] = 1; } int lst = 0; bool ok = 1; for(int i = 1; i <= n; i++){ if(!pos[i]) continue; if(!lst){ lst = i; continue; } if(pos[lst] < pos[i]){ if(pos[i]-pos[lst] != i-lst){ ok = 0; break; } } else{ if(pos[lst]-pos[i]-1 != lst-1+n-i){ ok = 0; break; } } lst = i; } return ok; } int replacement(int br,vector <int> gondolaSeq,vector <int> replacementSeq){ } int countReplacement(int br,vector <int> inputSeq){ } /*int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int a; cin >> a; int *niz = (int*)malloc(sizeof(int)*a); for(int i = 0; i < a; i++) cin >> niz[i]; cout << valid(a,niz) << endl; }*/

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

gondola.cpp: In function 'int replacement(int, std::vector<int>, std::vector<int>)':
gondola.cpp:46:1: warning: no return statement in function returning non-void [-Wreturn-type]
   46 | }
      | ^
gondola.cpp: In function 'int countReplacement(int, std::vector<int>)':
gondola.cpp:50:1: warning: no return statement in function returning non-void [-Wreturn-type]
   50 | }
      | ^
/usr/bin/ld: /tmp/cckqkMHA.o: in function `main':
grader.cpp:(.text.startup+0xb6): undefined reference to `valid'
/usr/bin/ld: grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
/usr/bin/ld: grader.cpp:(.text.startup+0x132): undefined reference to `replacement'
collect2: error: ld returned 1 exit status