Submission #127710

# Submission time Handle Problem Language Result Execution time Memory
127710 2019-07-10T03:04:39 Z Dr_Cow Gondola (IOI14_gondola) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "gondola.h"

int valid(int n, int inputSeq[]){
	int ip=-1;
	for (int i=0;i<n;i++){
		if (inputSeq[i]<=n){
			ip=i;break;
		}
	}
	if (ip==-1) return 1;
	else {
		n[ip]=inputSeq[ip];
		for (int i=ip+1;i<n;i++) {
			n[i]=n[i-1]+1;
			if (n[i]>n) n[i]-=n;
		}
		for (int i=ip-1;i>=0;i--){
			n[i]=n[i+1]-1;
			if (n[i]<=0) n[i]+=n;
		}
	}
	for (int i=0;i<n;i++)
		if (inputSeq[i]<=n && inputSeq[i]!=n[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

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:13:7: error: invalid types 'int[int]' for array subscript
   n[ip]=inputSeq[ip];
       ^
gondola.cpp:15:7: error: invalid types 'int[int]' for array subscript
    n[i]=n[i-1]+1;
       ^
gondola.cpp:15:14: error: invalid types 'int[int]' for array subscript
    n[i]=n[i-1]+1;
              ^
gondola.cpp:16:11: error: invalid types 'int[int]' for array subscript
    if (n[i]>n) n[i]-=n;
           ^
gondola.cpp:16:19: error: invalid types 'int[int]' for array subscript
    if (n[i]>n) n[i]-=n;
                   ^
gondola.cpp:19:7: error: invalid types 'int[int]' for array subscript
    n[i]=n[i+1]-1;
       ^
gondola.cpp:19:14: error: invalid types 'int[int]' for array subscript
    n[i]=n[i+1]-1;
              ^
gondola.cpp:20:11: error: invalid types 'int[int]' for array subscript
    if (n[i]<=0) n[i]+=n;
           ^
gondola.cpp:20:20: error: invalid types 'int[int]' for array subscript
    if (n[i]<=0) n[i]+=n;
                    ^
gondola.cpp:24:41: error: invalid types 'int[int]' for array subscript
   if (inputSeq[i]<=n && inputSeq[i]!=n[i]) return 0;
                                         ^