Submission #284193

#TimeUsernameProblemLanguageResultExecution timeMemory
284193Bill_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 a[], int replacementSeq[]) { int y[100000]={0}; for(int i=0;i<n;i++){ if(a[i]<=n){ 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:38:5: error: 'max' was not declared in this scope
   38 |   e=max(e,y[i]);
      |     ^~~