Submission #1250781

#TimeUsernameProblemLanguageResultExecution timeMemory
1250781hmms127Gondola (IOI14_gondola)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "gondola.h"
#define pb push_back
using namespace std;

int valid(int n, int a[])
{
    int idx;
    for(int i=0;i<n;i++){
        if(a[i]==1){idx=i;break;}
    }
    int sm=0;
    for(int i=idx;i<n;i++)sm+=a[i];
    int sz=n-idx;
    return (sm==sz*(sz+1)/2);
    
}
//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  int frq[n+1]={};
  for(int i=0;i<n;i++)frq[a[i]]++;
  for(int i=1;i<=n;i++){
      if(frq[a[i]]==0){
          replacementSeq[0]=i;
          break;
      }
  }
  return 1;
}

//----------------------

int countReplacement(int n, int inputSeq[])
{
  return -3;
}

Compilation message (stderr)

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:23:27: error: 'a' was not declared in this scope
   23 |   for(int i=0;i<n;i++)frq[a[i]]++;
      |                           ^
gondola.cpp:25:14: error: 'a' was not declared in this scope
   25 |       if(frq[a[i]]==0){
      |              ^