Submission #508856

#TimeUsernameProblemLanguageResultExecution timeMemory
508856tabrGondola (IOI14_gondola)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif #include "gondola.h" int valid(int n, int s[]) { set<int> st; for (int i = 0; i < n; i++) { if (st.count(s[i])) { return 0; } st.emplace(s[i]); } int pos = -1; for (int i = 0; i < n; i++) { if (s[i] <= n) { pos = (i - s[i] + 1 + n) % n; break; } } for (int i = 0; i < n; i++) { if (s[i] <= n) { if (pos != (i - s[i] + 1 + n) % n) { return 0; } } } return 1; } int replacement(int n, int s[], int res[]) { int pos = -1; for (int i = 0; i < n; i++) { if (s[i] <= n) { pos = (i - s[i] + 1 + n) % n; } } vector<int> order(n); iota(order.begin(), order.end(), 0); sort(order.begin(), order.end(), [&](int i, int j) { return s[i] < s[j]; }); int id = 0; int lst = n; for (int i : order) { if (s[i] <= n) { continue; } int j = (i - pos + n) % n + 1; res[id++] = j; for (int x = lst + 2; x <= s[i]; x++) { res[id++] = x - 1; } lst = s[i]; } return id; } int countReplacement(int n, int inputSeq[]);

Compilation message (stderr)

/usr/bin/ld: /tmp/ccdyy0T2.o: in function `main':
grader.cpp:(.text.startup+0x108): undefined reference to `countReplacement'
collect2: error: ld returned 1 exit status