Submission #106689

# Submission time Handle Problem Language Result Execution time Memory
106689 2019-04-19T16:50:51 Z tincamatei Gondola (IOI14_gondola) C++14
20 / 100
28 ms 1664 KB
#include "gondola.h"
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 100000;
int aux[MAX_N];

int valid(int n, int inputSeq[]) {
	int fixed = -1;
	for(int i = 0; i < n; ++i)
		if(inputSeq[i] <= n)
			fixed = i;
	
	for(int i = 0; i < n; ++i)
		aux[i] = inputSeq[i];
	
	sort(aux, aux + n);
	for(int i = 0; i < n - 1; ++i) // All gondolas must be distinct
		if(aux[i] == aux[i + 1])
			return false;

	if(fixed == -1) // All gondolas have been replaced
		return true;
	
	for(int i = 0; i < n; ++i) {
		int expected = (inputSeq[fixed] + i - 1) % n + 1;
		int expectedPos = (fixed + i) % n;
		if(!(inputSeq[expectedPos] == expected || inputSeq[expectedPos] > n))
			return false;
	}
	return true;
}

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

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 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 128 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 11 ms 896 KB Output is correct
7 Correct 22 ms 1536 KB Output is correct
8 Correct 16 ms 1280 KB Output is correct
9 Correct 7 ms 640 KB Output is correct
10 Correct 28 ms 1400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 9 ms 896 KB Output is correct
7 Correct 20 ms 1664 KB Output is correct
8 Correct 15 ms 1280 KB Output is correct
9 Correct 12 ms 640 KB Output is correct
10 Correct 21 ms 1400 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 10 ms 896 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 21 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 300 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 412 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -