Submission #586200

#TimeUsernameProblemLanguageResultExecution timeMemory
586200SeDunionGondola (IOI14_gondola)C++17
Compilation error
0 ms0 KiB
#include "gondola.h"
#include<iostream>

using namespace std;

int valid(int n, int inputSeq[]) {
	int id = -1;
	for (int i = 0 ; i < n ; ++ i) {
		if (inputSeq[i] <= n) id = i;
	}
	if (id == -1) return 1;
	int x = inputSeq[i];
	for (int i = 0 ; i + x <= n ; ++ i) {
		int j = (i + id) % n;
		if (inputSeq[j] != i + x) return 0;
	}
	for (int i = 0 ; i < x ; ++ i) {
		int j = (id - i + n) % n;
		if (inputSeq[j] != x - i) 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:12:19: error: 'i' was not declared in this scope
   12 |  int x = inputSeq[i];
      |                   ^