Submission #127705

# Submission time Handle Problem Language Result Execution time Memory
127705 2019-07-10T03:02:23 Z StevenH Gondola (IOI14_gondola) C++14
20 / 100
16 ms 1772 KB
#include "gondola.h"
#include <vector>
using namespace std;
int tag[10000000];
int a[2*100000+5];
int valid(int n, int inputSeq[])
{
	for(int i=0;i<n;i++)
		a[i]=a[n+i]=inputSeq[i];
	for(int i=0;i<n;i++)
	{
		if(!tag[a[i]])tag[a[i]]=1;
		else return 0;
	}
	int t=0;
	for(int i=0;i<n;i++)
		if(a[i]<=n)t=1;
	if(t==0)return 1;
	
	int res;t=0;
	for(int i=0;i<2*n;i++)
		if(a[i]>=1 && a[i]<=n && i+1>=a[i])
			{res=i;t=1;break;}
	
	for(int i=res;i<=res+n-a[res];i++)
		if(a[i]>=1 && a[i]<=n)
			if(a[i]!=i-res+a[res])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:20:6: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
  int res;t=0;
      ^~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 252 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 2 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 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 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 7 ms 888 KB Output is correct
7 Correct 14 ms 1656 KB Output is correct
8 Correct 11 ms 1400 KB Output is correct
9 Correct 5 ms 632 KB Output is correct
10 Correct 13 ms 1648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 7 ms 888 KB Output is correct
7 Correct 14 ms 1656 KB Output is correct
8 Correct 11 ms 1400 KB Output is correct
9 Correct 5 ms 632 KB Output is correct
10 Correct 13 ms 1656 KB Output is correct
11 Correct 7 ms 376 KB Output is correct
12 Correct 2 ms 252 KB Output is correct
13 Correct 8 ms 1528 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 16 ms 1772 KB Output is correct
# 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 2 ms 376 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 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 376 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -