답안 #52097

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52097 2018-06-23T22:10:51 Z spencercompton 곤돌라 (IOI14_gondola) C++17
20 / 100
49 ms 5260 KB
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;

int valid(int n, int inputSeq[])
{
	set<int> ss;
	for(int i = 0; i<n; i++){
		ss.insert(inputSeq[i]);
	}
	if(ss.size()!=n){
		return 0;
	}
	pair<int, int> first;
	first.first = n+1;
	first.second = -1;
	for(int i = 0; i<n; i++){
		if(inputSeq[i]<first.first){
			first.first = inputSeq[i];
			first.second = i;
		}
	}
	if(first.second==-1){
		return 1;
	}
	int pos = first.second;
	for(int i = 0; i<n; i++){
		if(inputSeq[i]<=n && i!=((first.second+inputSeq[i]-first.first)%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:11:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if(ss.size()!=n){
     ~~~~~~~~~^~~
gondola.cpp:26:6: warning: unused variable 'pos' [-Wunused-variable]
  int pos = first.second;
      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 492 KB Output is correct
3 Correct 2 ms 492 KB Output is correct
4 Correct 2 ms 492 KB Output is correct
5 Correct 2 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 696 KB Output is correct
3 Correct 2 ms 736 KB Output is correct
4 Correct 2 ms 736 KB Output is correct
5 Correct 2 ms 736 KB Output is correct
6 Correct 15 ms 2684 KB Output is correct
7 Correct 38 ms 4176 KB Output is correct
8 Correct 27 ms 4396 KB Output is correct
9 Correct 11 ms 4396 KB Output is correct
10 Correct 35 ms 5004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5004 KB Output is correct
2 Correct 3 ms 5004 KB Output is correct
3 Correct 2 ms 5004 KB Output is correct
4 Correct 2 ms 5004 KB Output is correct
5 Correct 2 ms 5004 KB Output is correct
6 Correct 14 ms 5004 KB Output is correct
7 Correct 36 ms 5004 KB Output is correct
8 Correct 27 ms 5004 KB Output is correct
9 Correct 9 ms 5004 KB Output is correct
10 Correct 34 ms 5004 KB Output is correct
11 Correct 2 ms 5004 KB Output is correct
12 Correct 2 ms 5004 KB Output is correct
13 Correct 21 ms 5004 KB Output is correct
14 Correct 2 ms 5004 KB Output is correct
15 Correct 49 ms 5260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5260 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5260 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5260 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5260 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5260 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5260 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 5260 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -