제출 #238248

#제출 시각아이디문제언어결과실행 시간메모리
238248nicolaalexandra곤돌라 (IOI14_gondola)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "gondola.h" #define DIM 100010 using namespace std; map <int,int> f; pair <int,int> w[DIM]; int sol[DIM]; int get_next (int val, int n){ if (val == n) return 1; return val+1; } int get_ant (int val, int n){ if (val == 1) return n; return val-1; } int valid (int n, int v[]){ int i, poz = -1; for (i=0;i<n;i++){ f[v[i]]++; if (f[v[i]] >= 2) return 0; } for (i=0;i<n;i++) if (v[i] <= n){ poz = i; break; } if (poz == -1) return 1; int val = v[poz]; for (i=poz+1;i<n;i++){ val = get_next (val,n); if (v[i] <= n && v[i] != val) return 0; } val = v[poz]; for (i=poz-1;i>=0;i--){ val = get_ant (val,n); if (v[i] <= n && v[i] != val) return 0; } return 1; } inline int cmp (pair<int,int> a, pair<int,int> b){ return a.second < b.second; } int replacement (int n, int v[], int replacementSeq[]){ int i, poz = -1, k = 0; for (i=0;i<n;i++) if (v[i] <= n){ poz = i; break; } /// if (poz == -1) int val = v[poz]; for (i=poz+1;i<n;i++){ val = get_next (val,n); if (v[i] > n) w[++k] = make_pair(val,v[i]); } val = v[poz]; for (i=poz-1;i>=0;i--){ val = get_ant (val,n); if (v[i] > n) w[++k] = make_pair(val,v[i]); } sort (w+1,w+k+1,cmp); int last = n+1, el = 0; for (i=1;i<=k;i++){ replacementSeq[el++] = w[i].first; while (last <= w[i].second){ if (last < w[i].second) replacementSeq[el++] = last; last++; } } return el; }

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

/tmp/ccw9lhwx.o: In function `main':
grader.cpp:(.text.startup+0xc3): undefined reference to `countReplacement'
collect2: error: ld returned 1 exit status