Submission #284192

#TimeUsernameProblemLanguageResultExecution timeMemory
284192Bill_00Gondola (IOI14_gondola)C++14
Compilation error
0 ms0 KiB
#include <stdlib.h> #include "gondola.h" int valid(int n, int a[]) { int k[250000]={0}; int y[250000]={0},d=0; for(int i=0;i<n;i++){ k[a[i]]++; } for(int i=0;i<n;i++){ if(k[a[i]]>1) return 0; } for(int i=0;i<n;i++){ if(a[i]<=n){ if(y[(a[i]-i+n)%n]==0) d++; y[(a[i]-i+n)%n]++; } } if(d<=1) return 1; return 0; } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int y[100000]={0}; for(int i=0;i<n;i++){ if(a[i]<=n){ if(y[(a[i]-i+n)%n]==0) d++; y[(a[i]-i+n)%n]++; } } int e=0; for(int i=0;i<n;i++){ e=max(e,y[i]); } return n-e; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

Compilation message (stderr)

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:32:6: error: 'a' was not declared in this scope
   32 |   if(a[i]<=n){
      |      ^
gondola.cpp:33:27: error: 'd' was not declared in this scope
   33 |    if(y[(a[i]-i+n)%n]==0) d++;
      |                           ^
gondola.cpp:39:5: error: 'max' was not declared in this scope
   39 |   e=max(e,y[i]);
      |     ^~~