답안 #118827

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
118827 2019-06-19T22:49:02 Z ly20 곤돌라 (IOI14_gondola) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
const int INF=1123456789;
map<int,int> vld;
#include "gondola.h"
int valid(int n,int seq[])
{
	int mn=INF,at=INF,at2=INF;
	int st=0;
	bool vl=1;
	for(int i=0;i<n;i++)
	{
		if(vld[seq[i]]>0)vl=0;
		vld[seq[i]]++;
		if(st==0)
		{
			if(seq[i]>n)continue;
			if(seq[i]<at && at==INF)
			{
				at=seq[i];mn=seq[i];
			}
			else if(seq[i]<at)
			{
				at2=seq[i];st=1;
				if(at2>mn)vl=0;
			}
			else at=seq[i];
		}
		else
		{
			if(seq[i]>n)continue;
			if(seq[i]<at2 || seq[i]>mn || seq[i]>at)vl=0;
			at2=seq[i];
		}
	}	
	return vl;
}
int replacement(int n,int gondolaseq[],int replacementseq[])
{
	return 0;
}
int countReplacement(int n,int inputSeq[])
{
	return 0;
}#include<bits/stdc++.h>
using namespace std;
const int INF=1123456789;
map<int,int> vld;
#include "gondola.h"
int valid(int n,int seq[])
{
	int mn=INF,at=INF,at2=INF;
	int st=0;
	bool vl=1;
	for(int i=0;i<n;i++)
	{
		if(vld[seq[i]]>0)vl=0;
		vld[seq[i]]++;
		if(st==0)
		{
			if(seq[i]>n)continue;
			if(seq[i]<at && at==INF)
			{
				at=seq[i];mn=seq[i];
			}
			else if(seq[i]<at)
			{
				at2=seq[i];st=1;
				if(at2>mn)vl=0;
			}
			else at=seq[i];
		}
		else
		{
			if(seq[i]>n)continue;
			if(seq[i]<at2 || seq[i]>mn || seq[i]>at)vl=0;
			at2=seq[i];
		}
	}	
	return vl;
}
int replacement(int n,int gondolaseq[],int replacementseq[])
{
	return 0;
}
int countReplacement(int n,int inputSeq[])
{
	return 0;
}

Compilation message

gondola.cpp:45:2: error: stray '#' in program
 }#include<bits/stdc++.h>
  ^
gondola.cpp:45:3: error: 'include' does not name a type
 }#include<bits/stdc++.h>
   ^~~~~~~
gondola.cpp:47:11: error: redefinition of 'const int INF'
 const int INF=1123456789;
           ^~~
gondola.cpp:3:11: note: 'const int INF' previously defined here
 const int INF=1123456789;
           ^~~
gondola.cpp:48:14: error: redefinition of 'std::map<int, int> vld'
 map<int,int> vld;
              ^~~
gondola.cpp:4:14: note: 'std::map<int, int> vld' previously declared here
 map<int,int> vld;
              ^~~
gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:50:5: error: redefinition of 'int valid(int, int*)'
 int valid(int n,int seq[])
     ^~~~~
gondola.cpp:6:5: note: 'int valid(int, int*)' previously defined here
 int valid(int n,int seq[])
     ^~~~~
gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:82:5: error: redefinition of 'int replacement(int, int*, int*)'
 int replacement(int n,int gondolaseq[],int replacementseq[])
     ^~~~~~~~~~~
gondola.cpp:38:5: note: 'int replacement(int, int*, int*)' previously defined here
 int replacement(int n,int gondolaseq[],int replacementseq[])
     ^~~~~~~~~~~
gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:86:5: error: redefinition of 'int countReplacement(int, int*)'
 int countReplacement(int n,int inputSeq[])
     ^~~~~~~~~~~~~~~~
gondola.cpp:42:5: note: 'int countReplacement(int, int*)' previously defined here
 int countReplacement(int n,int inputSeq[])
     ^~~~~~~~~~~~~~~~