답안 #51914

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
51914 2018-06-22T16:12:43 Z zetapi 곤돌라 (IOI14_gondola) C++14
컴파일 오류
0 ms 0 KB
#include <gondola.h>
#include <bits/stdc++.h>
using namespace std;

#define pb  push_back
#define mp  make_pair
#define ll long long
#define itr ::iterator 

typedef pair<int,int>  pii;

const int MAX=5e5;

int arr[MAX],fre[MAX];

int valid(int n=5,vector<int> inputSeq={10, 4, 3, 11, 12})
{
  int N=n,ok=1;
  for(int A=0;A<N;A++)
  {
	  fre[inputSeq[A]]++;
	  if(fre[inputSeq[A]]>1)
	  	return 0;
  }
  for(int A=0;A<N;A++)
  {
  	  if(inputSeq[A]<=N)
  	  {
		 ok=0;
		 inputSeq[A]--;
		 for(int B=A;B>=0;B--)
		 {
		 	arr[B]=inputSeq[A];
		 	inputSeq[A]--;
		 	if(inputSeq[A]<0)
		 		inputSeq[A]+=N;
		 }
		 inputSeq[A]=arr[A];
		 for(int B=A+1;B<N;B++)
		 {
		 	inputSeq[A]++;
		 	if(inputSeq[A]>=N)
		 		inputSeq[A]=0;
		 	arr[B]=inputSeq[A];
		 }
		 inputSeq[A]=arr[A]+1;
		 break;
	  }
  }
  if(ok)
  	 return 1;
  for(int A=0;A<N;A++)
  	 arr[A]++;
 // for(int A=0;A<N;A++)
  ///	 cout<<arr[A]<<" ";
  for(int A=0;A<N;A++)
  {
  	 // cout<<arr[A]<<" "<<inputSeq[A]<<"\n";
  	  if(inputSeq[A]<=N and arr[A]!=inputSeq[A])
  	  	return 0;	
  }
  	return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  return -2;
}

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

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

/*int main()
{
	ios_base::sync_with_stdio(false);

	cout<<"hp ";	
	cout<<valid()<<"\n";
	return 0;
}*/

Compilation message

/tmp/ccIae8KU.o: In function `main':
grader.cpp:(.text.startup+0xe2): undefined reference to `valid'
collect2: error: ld returned 1 exit status