Submission #160253

# Submission time Handle Problem Language Result Execution time Memory
160253 2019-10-26T13:13:10 Z BlueDiamond Gondola (IOI14_gondola) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

const int L = 250000 + 7;
int who[L];

bool valid(int n, vector <int> a) {
        memset(who, -1, sizeof who);
        for (int i = 0; i < n; i++) {
                a[i]--;
                who[a[i]] = i;
        }

        int i = L - 1;
        while (i >= 0) {
                if (who[i] == -1) {
                        i--;
                        continue;
                }
                int j = i - 1;
                while (j >= 0 && who[j] != -1)
                        j--;
                if (j < 0)
                        break;
                who[j] = who[i];
                who[i] = -1;
                i = j - 1;
        }
        for (int i = 0; i < n; i++)
                if (who[i] == -1)
                        return -1;
        for (int i = 1; i < n; i++) {
                int dist = who[i] - who[i - 1];
                if (dist < 0)
                        dist += n;
                if (dist != 1)
                        return 0;
        }
        return 1;
}

Compilation message

/tmp/ccqKltIy.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