Submission #838390

# Submission time Handle Problem Language Result Execution time Memory
838390 2023-08-26T18:35:21 Z MohamedAhmed04 Gondola (IOI14_gondola) C++14
20 / 100
26 ms 5760 KB
#include <bits/stdc++.h>
#include "gondola.h"

using namespace std ;

const int MAX = 2e5 + 10 ;

int arr[MAX] ;

int valid(int n, int inputSeq[])
{
	for(int i = 0 ; i < 2*n ; ++i)
		arr[i] = inputSeq[i%n] ;
	set<int>s ;
	for(int i = 0 ; i < n ; ++i)
		s.insert(arr[i]) ;
	if(s.size() != n)
		return 0 ;
	int idx = -1 ;
	for(int i = 0 ; i < n ; ++i)
	{
		if(arr[i] <= n)
			idx = i ;
	}
	if(idx == -1)
		return 1 ;
	int now = arr[idx]-1 ;
	for(int i = idx ; i < idx+n ; ++i)
	{
		++now ;
		if(now == n+1)
			now = 1 ;
		if(arr[i] != now && arr[i] <= n)
			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:17:14: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |  if(s.size() != n)
      |     ~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 304 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 9 ms 2608 KB Output is correct
7 Correct 23 ms 4856 KB Output is correct
8 Correct 17 ms 4840 KB Output is correct
9 Correct 6 ms 1748 KB Output is correct
10 Correct 21 ms 5544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 8 ms 2608 KB Output is correct
7 Correct 20 ms 4860 KB Output is correct
8 Correct 16 ms 4868 KB Output is correct
9 Correct 6 ms 1720 KB Output is correct
10 Correct 20 ms 5588 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 11 ms 2656 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 26 ms 5760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 308 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -