Submission #118842

# Submission time Handle Problem Language Result Execution time Memory
118842 2019-06-19T23:32:32 Z ly20 Gondola (IOI14_gondola) C++17
0 / 100
4 ms 384 KB
#include<bits/stdc++.h>
using namespace std;
const int INF=1123456789,MAXN=250010;
#define debug(args...) fprintf(stderr,args)
map<int,int> vld;
int marc[MAXN];
#include "gondola.h"
int valid(int n,int seq[])
{
	int mn=INF,at=INF,at2=INF,id0=0;
	int st=0;
	bool vl=1;
	for(int i=0;i<n;i++)
	{
		if(vl==0)debug("%d\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];
				id0=(i+1-mn+n)%n;
			}
			else if(seq[i]<at)
			{
				at2=seq[i];st=1;
				if(at2>mn)vl=0;
			}
			else
			{
				if((id0+seq[i]-1)%n!=i)vl=0;
				at=seq[i];
			}
		}
		else
		{
			if(seq[i]>n)continue;
			if(seq[i]<at2 || seq[i]>mn || seq[i]>at)vl=0;
			if((id0+seq[i]-1)%n!=i)vl=0;
			at2=seq[i];
		}
		debug("%d %d %d\n",i,id0,(id0+seq[i])%n);
	}	
	return vl;
}
int replacement(int n,int seq[],int replacementseq[])
{
	vector<pair<int,int> > v;
	int mn=INF,at=INF,at2=INF,id0=0,mx=0,imx=0;
	int st=0;
	bool vl=1;
	for(int i=0;i<n;i++)
	{
		if(seq[i]>n)marc[seq[i]]=1;
		if(mx<seq[i])imx=i;
		mx=max(mx,seq[i]);
		if(vl==0)debug("%d\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];
				id0=(i+1-mn+n)%n;
			}
			else if(seq[i]<at)
			{
				at2=seq[i];st=1;
				if(at2>mn)vl=0;
			}
			else
			{
				if((id0+seq[i]-1)%n!=i)vl=0;
				at=seq[i];
			}
		}
		else
		{
			if(seq[i]>n)continue;
			if(seq[i]<at2 || seq[i]>mn || seq[i]>at)vl=0;
			if((id0+seq[i]-1)%n!=i)vl=0;
			at2=seq[i];
		}
		debug("%d %d %d\n",i,id0,(id0+seq[i])%n);
	}
	for(int i=0;i<n;i++)if(seq[i]>n)replacementseq[seq[i]-n-1]=i;
	for(int i=n+1;i<mx;i++)if(!marc[i])replacementseq[i]=imx;
	return mx-n;
}
int countReplacement(int n,int inputSeq[])
{
	return 0;
}
/*int main()
{
	int n;
	int v[40];
	scanf("%d",&n);
	for(int i=0;i<n;i++)scanf("%d",&v[i]);
	printf("%d\n",valid(n,v));
	return 0;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB 잘못된 접근입니다.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -