Submission #30265

# Submission time Handle Problem Language Result Execution time Memory
30265 2017-07-23T07:33:18 Z inqr Gondola (IOI14_gondola) C++14
10 / 100
16 ms 4564 KB
#include "gondola.h"
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rt insert
#define st first
#define nd second
#define ll long long
#define pii pair < int , int >
#define DB printf("debug\n");
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define all(x) x.begin() , x.end()
using namespace std;

int valid(int n, int inputSeq[])
{
	vector < int > timesseen(n+5,0);
	vector < int > orig;
	for(int i=0;i<n;i++){
		timesseen[inputSeq[i]]++;
		if(timesseen[inputSeq[i]]>1)return 0;
		if(inputSeq[i]<=n)orig.pb(inputSeq[i]);
	}
	int startover=0;
	for(int i=0;i<orig.size();i++){
		if(i!=orig.size()-1){
			if(orig[i]<orig[i+1]){
				continue;
			}
			else if(startover==0)startover++;
			else if(startover==1)return 0;
		}
		else{
			if(orig[i]<orig[0]){
				continue;
			}
			else if(startover==0)startover++;
			else if(startover==1)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:26:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<orig.size();i++){
               ^
gondola.cpp:27:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(i!=orig.size()-1){
       ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3384 KB Output is correct
2 Correct 0 ms 3384 KB Output is correct
3 Correct 0 ms 3384 KB Output is correct
4 Correct 0 ms 3384 KB Output is correct
5 Correct 0 ms 3384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3384 KB Output is correct
2 Correct 0 ms 3384 KB Output is correct
3 Correct 0 ms 3384 KB Output is correct
4 Correct 0 ms 3384 KB Output is correct
5 Correct 0 ms 3384 KB Output is correct
6 Correct 6 ms 4000 KB Output is correct
7 Correct 9 ms 3728 KB Output is correct
8 Correct 13 ms 4516 KB Output is correct
9 Correct 3 ms 3680 KB Output is correct
10 Correct 9 ms 4564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3384 KB Output is correct
2 Correct 0 ms 3384 KB Output is correct
3 Correct 0 ms 3384 KB Output is correct
4 Correct 0 ms 3384 KB Output is correct
5 Correct 0 ms 3384 KB Output is correct
6 Correct 3 ms 4000 KB Output is correct
7 Correct 16 ms 3728 KB Output is correct
8 Correct 13 ms 4516 KB Output is correct
9 Correct 3 ms 3680 KB Output is correct
10 Correct 13 ms 4564 KB Output is correct
11 Correct 0 ms 3384 KB Output is correct
12 Incorrect 0 ms 3384 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3384 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3384 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3384 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3384 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3384 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3384 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3384 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -