Submission #1153085

#TimeUsernameProblemLanguageResultExecution timeMemory
1153085vladiliusGondola (IOI14_gondola)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define pb push_back
#define ff first
#define ss second
const int A = 2.5e5;

int valid(int n, int x[]){
    vector<bool> f(A + 1);
    int m = 0;
    for (int i = 0; i < n; i++){
        if (f[x[i]]) return 0;
        f[x[i]] = 1;
        m = max(m, x[i]);
    }
    
    pii mn = {1e9, 0};
    for (int i = 0; i < n; i++) mn = min(mn, {x[i], i});
    
    int p = mn.ss;
    vector<int> y(n);
    for (int i = 0; i < n; i++){
        int j = i - p;
        if (j < 0) j += n;
        y[j] = x[i];
    }
    
    int X = y[0];
    for (int i = 1; i < n; i++){
        if (y[i] > n) continue;
        int Y = y[i] - i;
        if (Y < 0) Y += n;
        if (Y != X) return 0;
    }
    
    if (m >= 2 * n) return 1;
    int cc = 0;
    for (int i = 1; i <= n; i++) cc += f[i];
    
    if ((n - cc) > (m - n)) return 0;
    
    return 1;
}

Compilation message (stderr)

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