Submission #51925

# Submission time Handle Problem Language Result Execution time Memory
51925 2018-06-22T16:26:36 Z zetapi Gondola (IOI14_gondola) C++14
20 / 100
23 ms 6108 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,int inputSeq[])
{
  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;
}




# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 420 KB Output is correct
4 Correct 2 ms 424 KB Output is correct
5 Correct 2 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 480 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 3 ms 536 KB Output is correct
5 Correct 3 ms 556 KB Output is correct
6 Correct 9 ms 1200 KB Output is correct
7 Correct 23 ms 2052 KB Output is correct
8 Correct 13 ms 2616 KB Output is correct
9 Correct 6 ms 2616 KB Output is correct
10 Correct 23 ms 3400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3400 KB Output is correct
2 Correct 3 ms 3400 KB Output is correct
3 Correct 2 ms 3400 KB Output is correct
4 Correct 3 ms 3400 KB Output is correct
5 Correct 2 ms 3400 KB Output is correct
6 Correct 13 ms 3400 KB Output is correct
7 Correct 16 ms 4060 KB Output is correct
8 Correct 13 ms 4444 KB Output is correct
9 Correct 6 ms 4444 KB Output is correct
10 Correct 14 ms 5260 KB Output is correct
11 Correct 2 ms 5260 KB Output is correct
12 Correct 2 ms 5260 KB Output is correct
13 Correct 8 ms 5608 KB Output is correct
14 Correct 2 ms 5608 KB Output is correct
15 Correct 16 ms 6108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 6108 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6108 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6108 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6108 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6108 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 6108 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6108 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -