Submission #250730

#TimeUsernameProblemLanguageResultExecution timeMemory
250730ant101Gondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> #include <cstring> #include <iomanip> #include <fstream> #include <cmath> #include <vector> #include <set> #include <unordered_set> #include <unordered_map> #include <map> #include <stack> #include <queue> #include <assert.h> #include <limits> #include <cstdio> #include <complex> #include "gondola.h" #define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; int n, t; long long int G[100002]; set<int> vis; int valid() { for (int i = 1; i <= n; i++) { if (vis.find(G[i]) != vis.end()) return 0; vis.insert(G[i]); } int start = 0; for (int i = 1; i <= n; i++) { if (G[i] <= n) { start = i; break; } } if (!start) return 1; int pos = start, next = G[start]; for (int i = 1; i <= n; i++) { if (G[pos] <= n) { if (G[pos] != next) return 0; } pos++; if (pos > n) pos = 1; next++; if (next > n) next = 1; } return 1; } int R, rep[250002]; pair<int, int> X[100002]; int last; void replacement() { int start = 1; for (int i = 1; i <= n; i++) { if (G[i] <= n) { start = i; break; } } int pos = start; int next = G[start] <= n ? G[start] : 1; for (int i = 1; i <= n; i++) { X[i] = make_pair(G[pos], next); pos++; if (pos > n) pos = 1; next++; if (next > n) next = 1; } sort(X + 1, X + n + 1); last = n; for (int i = 1; i <= n; i++) { while(X[i].second != X[i].first) { rep[++R] = X[i].second; X[i].second = ++last; } } } long long int mod = 1000000009; long long int A[100002], C; long long int pow(long long int a, long long int x) { if (x == 0 || a == 1) return 1; if (x % 2) return (pow(a, x - 1) * a) % mod; long long int h = pow(a, x/2); return (h * h) % mod; } long long int countReplacement() { if (!valid()) return 0; for (int i = 1; i <= n; i++) if (G[i] > n) A[++C] = G[i]; sort(A + 1, A + C + 1); long long int ret = C == n ? n : 1; A[0] = (long long int)(n); for (long long int i = 1; i <= C; i++ ) { ret *= pow(C - i + 1, A[i] - A[i - 1] - 1); ret %= mod; } return ret; }

Compilation message (stderr)

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