Submission #1323381

#TimeUsernameProblemLanguageResultExecution timeMemory
1323381hynmjGondola (IOI14_gondola)C++20
Compilation error
0 ms0 KiB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int valid(int n, int a[])
{
  set<int> s;
  for (int i = 0; i < n; i++)
  {
    a[i]--;
    s.insert(a[i]);
  }
  if (s.size() != n)
    return 0;
  int j = 0;
  bool ok = 1;
  for (int i = 0; i < n; i++)
  {
    if (a[i] < n)
    {
      ok = 0;
      j = (i - a[i] + n) % n;
      break;
    }
  }
  if (ok)
    return 1;
  for (int k = 0; k < n; k++, j++)
  {
    if (a[i] < n && a[i] != k)
    {
      return 0;
    }
  }
  return 1;
}

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

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:29:11: error: 'i' was not declared in this scope
   29 |     if (a[i] < n && a[i] != k)
      |           ^