Submission #161287

#TimeUsernameProblemLanguageResultExecution timeMemory
161287DavidDamianGondola (IOI14_gondola)C++11
Compilation error
0 ms0 KiB
///Determine weather a sequence is valid ///Construct a replacement sequence ///Count the number of replacement sequences using namespace std; int bucket[250005]; int findFirst (int n,int A[]){ ///Finds the first element in the arrar less or equal to n for(int i=0;i<n;i++){ if(A[i]<=n) return i; } return -1; } int valid(int n, int inputSeq[]) { int id=findFirst(n,inputSeq); for(int i=0;i<n;i++){ if(bucket[ inputSeq[i] ]==1) //Checks every element to not be repeated return 0; bucket[inputSeq[i]]=1; } if(id==-1) //If there are no repeated elements and all elemets are greater than n, the sequence is valid return 1; int x=inputSeq[id]; for(int i=0;i<n;i++){ //Otherwise checks for each element if it is the same than expected (x) if(inputSeq[(id+i)%n]<=n) if(inputSeq[(id+i)%n]!=x) return 0; x++; if(x==n+1) x=1; } return 1; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

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