답안 #55575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55575 2018-07-08T06:45:15 Z leejseo 곤돌라 (IOI14_gondola) C++
10 / 100
34 ms 1512 KB
#include "gondola.h"
#include <vector>
#include <algorithm>
using namespace std;

int valid(int n, int inputSeq[])
{
	int min_val = 1000000, min_index = -1;
	vector<int> L;
	for (int i=0; i<n; i++){
		L.push_back(inputSeq[i]);
		if (min_val > inputSeq[i]){
			min_index = i;
			min_val = inputSeq[i];
		}
	}
	sort(L.begin(), L.end());
	for (int i=1; i<n; i++) {
		if (L[i] == L[i-1]) return 0;
	}
	int mi = -1;
	for (int i=0; i<n; i++){
		if (L[i] > n && mi == -1) {
			mi = i;	
			break;
		}
	}
	if (mi == 0) return 1;	
	int bi = min_index;
	for (int j=1; j<n; j++){
		int i = (j + min_index) % n;
		if (inputSeq[i] > n) continue;
		if (inputSeq[i] < inputSeq[bi]) return 0;
		bi = i;
	}
	return 1;
}

//----------------------

int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
  int min_val = 1000000, min_index = -1;
	vector<int> L;
	for (int i=0; i<n; i++){
		L.push_back(gondolaSeq[i]);
	}
	return -2;
}

//----------------------

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

Compilation message

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:43:7: warning: unused variable 'min_val' [-Wunused-variable]
   int min_val = 1000000, min_index = -1;
       ^~~~~~~
gondola.cpp:43:26: warning: unused variable 'min_index' [-Wunused-variable]
   int min_val = 1000000, min_index = -1;
                          ^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 4 ms 484 KB Output is correct
5 Correct 3 ms 492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 644 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 3 ms 644 KB Output is correct
4 Correct 3 ms 644 KB Output is correct
5 Correct 2 ms 644 KB Output is correct
6 Correct 12 ms 1132 KB Output is correct
7 Correct 28 ms 1512 KB Output is correct
8 Correct 17 ms 1512 KB Output is correct
9 Correct 13 ms 1512 KB Output is correct
10 Correct 34 ms 1512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1512 KB Output is correct
2 Correct 3 ms 1512 KB Output is correct
3 Correct 3 ms 1512 KB Output is correct
4 Correct 2 ms 1512 KB Output is correct
5 Correct 3 ms 1512 KB Output is correct
6 Correct 13 ms 1512 KB Output is correct
7 Correct 26 ms 1512 KB Output is correct
8 Correct 16 ms 1512 KB Output is correct
9 Correct 10 ms 1512 KB Output is correct
10 Correct 34 ms 1512 KB Output is correct
11 Correct 3 ms 1512 KB Output is correct
12 Incorrect 2 ms 1512 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1512 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1512 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1512 KB Integer -2 violates the range [0, 350000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1512 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1512 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1512 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1512 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -