Submission #140187

#TimeUsernameProblemLanguageResultExecution timeMemory
140187ggohGondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include "gondola.h" #include <bits/stdc++.h> int ch[100005],i; struct A{ int val,ind; }data[100005]; bool cmp(A aa,A bb){return aa.val<bb.val;} int valid(int n, int inputSeq[]) { int ST=-1,st,C=1; for(i=0;i<n;i++)ch[i]=0; for(i=0;i<n;i++) { if(ch[inputSeq[i]]==1){C=0;break;} ch[inputSeq[i]]=1; } for(i=0;i<n;i++) { if(inputSeq[i]<=n) { st=i-inputSeq[i]+1;st=(st+n)%n; if(ST==-1)ST=st; else if(ST!=st){C=0;break;} } } return C; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int ST=0,ba,sz=0,ans=0; for(i=0;i<n;i++) { if(gondolaSeq[i]<=n)ST=(i-gondolaSeq[i]+1+n)%n; else data[sz++]={gondolaSeq[i],i}; } ba=n; for(i=0;i<sz;i++) { replacementSeq[ans++]=(data[i].ind-ST+n)%n+1; for(int j=ba+1;j<data[i].val;j++) { replacementSeq[ans++]=j; } ba=data[i].val; } return ans; } //---------------------- int countReplacement(int n, int inputSeq[]) { int m=0,ST=0; long long X=1e9+9,ans=1; for(i=0;i<n;i++) { m=std::max(gondolaSeq[i],m); ch[gondolaSeq[i]]=i; if(gondolaSeq[i]<=n)ST=(i-gondolaSeq[i]+1+n)%n; } return ans; }

Compilation message (stderr)

gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:62:20: error: 'gondolaSeq' was not declared in this scope
         m=std::max(gondolaSeq[i],m);
                    ^~~~~~~~~~
gondola.cpp:59:15: warning: unused variable 'X' [-Wunused-variable]
     long long X=1e9+9,ans=1;
               ^