Submission #91158

# Submission time Handle Problem Language Result Execution time Memory
91158 2018-12-26T12:18:30 Z arman_ferdous Gondola (IOI14_gondola) C++17
20 / 100
45 ms 5768 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;

set<int> st;
int valid(int n, int inputSeq[])
{
	int last = -1, start = -1, num = 1000000;
	for(int i = 0; i < n; i++) {
		st.insert(inputSeq[i]);
		if(inputSeq[i] > n) inputSeq[i] = -1;
		else {
			last = i;
			if(inputSeq[i] < num) 
				start = i, num = inputSeq[i];
		}
	}
	if(st.size() != n) return 0;
	if(last == -1) return 1;
	for(int i = start; i < n; i++)
		if(inputSeq[i] + 1 && inputSeq[i] != num + i - start)
			return 0;
	int at0 = inputSeq[last] + n - last;
	for(int i = 0; i < start; i++)
		if(inputSeq[i] + 1 && inputSeq[i] != at0 + i)
			return 0;

  	return 1;
}

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

int countReplacement(int n, int inputSeq[])
{
 	return -3;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:18:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(st.size() != n) return 0;
     ~~~~~~~~~~^~~~
# 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 576 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 688 KB Output is correct
4 Correct 2 ms 688 KB Output is correct
5 Correct 2 ms 688 KB Output is correct
6 Correct 13 ms 2356 KB Output is correct
7 Correct 33 ms 3892 KB Output is correct
8 Correct 23 ms 4148 KB Output is correct
9 Correct 8 ms 4148 KB Output is correct
10 Correct 30 ms 4788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4788 KB Output is correct
2 Correct 2 ms 4788 KB Output is correct
3 Correct 2 ms 4788 KB Output is correct
4 Correct 2 ms 4788 KB Output is correct
5 Correct 2 ms 4788 KB Output is correct
6 Correct 12 ms 4788 KB Output is correct
7 Correct 32 ms 4788 KB Output is correct
8 Correct 24 ms 4788 KB Output is correct
9 Correct 8 ms 4788 KB Output is correct
10 Correct 28 ms 4812 KB Output is correct
11 Correct 2 ms 4812 KB Output is correct
12 Correct 2 ms 4812 KB Output is correct
13 Correct 17 ms 4812 KB Output is correct
14 Correct 2 ms 4812 KB Output is correct
15 Correct 45 ms 5768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5768 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5768 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5768 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5768 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5768 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5768 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 5768 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -