Submission #52977

# Submission time Handle Problem Language Result Execution time Memory
52977 2018-06-27T12:08:48 Z zetapi Gondola (IOI14_gondola) C++14
0 / 100
3 ms 736 KB
#include "gondola.h"
#include "bits/stdc++.h"
using namespace std;

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

int valid(int n, int inputSeq[])
{
 	return -1;
}

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

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
   	return -2;
}

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

int countReplacement(int n, int inputSeq[])
{
	int cnt=0;
	vector<int> vec;
	for(int A=0;A<n;A++)
		vec.pb(inputSeq[A]);
	sort(vec.begin(),vec.end());
	for(int A=0;A<vec.size();A++)
		if(vec[A]==vec[A-1])
			return 0;	
	for(int A=0;A<vec.size();A++)
		if(vec[A]>n)
			cnt++;
	if(cnt==1 or cnt==3)
		return 1;
	for(int A=0;A<n;A++)
	{
		if(inputSeq[A]<=n)
			continue;
		for(int B=A+1;B<n;B++)
		{
			if(inputSeq[B]<=n)
				continue;
			else if(inputSeq[A]<inputSeq[B] or vec.back()-n<3)
				return 1;
			else
			return 2;
		}
	}
  	return 2;
}

/*int main()
{
	int n,inputSeq[]={1,2,6,7};
	cout<<countReplacement(4,inputSeq);
	return 0;
}*/

Compilation message

gondola.cpp: In function 'int countReplacement(int, int*)':
gondola.cpp:31:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=0;A<vec.size();A++)
              ~^~~~~~~~~~~
gondola.cpp:34:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int A=0;A<vec.size();A++)
              ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 488 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 488 KB Integer -1 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 488 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 512 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 564 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 564 KB Output is correct
2 Correct 2 ms 592 KB Output is correct
3 Incorrect 2 ms 736 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 736 KB Output is correct
2 Correct 2 ms 736 KB Output is correct
3 Incorrect 2 ms 736 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 736 KB Output is correct
2 Correct 2 ms 736 KB Output is correct
3 Incorrect 2 ms 736 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 736 KB Output is correct
2 Correct 2 ms 736 KB Output is correct
3 Incorrect 2 ms 736 KB Output isn't correct
4 Halted 0 ms 0 KB -