Submission #712996

#TimeUsernameProblemLanguageResultExecution timeMemory
712996mdubGondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

int valid(int n, vector<int> inputSeq) {
  for (auto& elem: inputSeq) {
    elem--;
  }
  pair<int, int> smallest = {1e9, -1};
  for (int i = 0; i < n; i++) {
    if (inputSeq[i] < smallest.first) {
      smallest = {inputSeq[i], i};
    }
  }
  set<int> seen;
  if (smallest.first >= n) smallest.first = 0;
  int next = smallest.first;
  for (int i = smallest.second; i < n + smallest.second; i++) {
    if (inputSeq[i % n] != next && (seen.count(inputSeq[i % n]) || inputSeq[i % n] < n)) {
	return 0;
    }
    next = (next + 1) % n;
    seen.insert(inputSeq[i % n]);
  }
  return 1;
}

Compilation message (stderr)

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