Submission #638379

#TimeUsernameProblemLanguageResultExecution timeMemory
638379ggohGondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include<gondola.h> #include<bits/stdc++.h> using namespace std; typedef long long lint; int valid(int n, int inputSeq[]) { vector<int>check(n+1); vector<int>copy)(n); for(int i=0;i<n;i++) { copy[i]=inputSeq[i]; if(inputSeq[i]<=n)check[inputSeq[i]]=i+1; } sort(copy,copy+n); for(int i=0;i<n;i++)if(copy[i]==copy[i+1])return 0; int c=0,ans=1,pos,t; for(int i=1;i<=n;i++) { if(check[i]) { if(!c)c=i,pos=check[i]; else { t=check[i]-pos; if(t<=0)t+=n; if(t!=i-c)ans=0; } } } return ans; } int replacement(int n, int gondolaSeq[], int replacementSeq[]) { return -2; } int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:9:18: error: expected initializer before ')' token
    9 |   vector<int>copy)(n);
      |                  ^
gondola.cpp:12:9: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   12 |     copy[i]=inputSeq[i];
      |         ^
gondola.cpp:15:17: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator+'
   15 |   sort(copy,copy+n);
      |             ~~~~^~
gondola.cpp:16:30: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |   for(int i=0;i<n;i++)if(copy[i]==copy[i+1])return 0;
      |                              ^
gondola.cpp:16:39: error: invalid types '<unresolved overloaded function type>[int]' for array subscript
   16 |   for(int i=0;i<n;i++)if(copy[i]==copy[i+1])return 0;
      |                                       ^