답안 #285665

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
285665 2020-08-29T11:48:51 Z Saboon 곤돌라 (IOI14_gondola) C++14
55 / 100
30 ms 2680 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;

bool mark[250000 + 10];

int valid(int n, int inputSeq[]){
	for (int i = 0; i < n; i++){
		if (mark[inputSeq[i]])
			return false;
		mark[inputSeq[i]] = 1;
	}
	int idx = min_element(inputSeq, inputSeq+n) - inputSeq;
	if (inputSeq[idx] > n)
		return true;
	int cnt = 0;
	for (int i = idx; i < n; i++){
		if (inputSeq[i] <= n and inputSeq[idx]+cnt != inputSeq[i])
			return false;
		cnt ++;
	}
	for (int i = 0; i < idx; i++){
		if (inputSeq[i] <= n and inputSeq[idx]+cnt != inputSeq[i])
			return false;
		cnt ++;
	}
	return true;
}

int p[maxn];

int replacement(int n, int gondolaSeq[], int replacementSeq[]){
	for (int i = 0; i < n; i++)
		p[i] = i+1;
	for (int i = 0; i < n; i++){
		if (gondolaSeq[i] > n)
			continue;
		int cnt = 0;
		for (int j = i; j < n; j++)
			p[j] = (gondolaSeq[i]+cnt-1)%n+1, cnt++;
		for (int j = 0; j < i; j++)
			p[j] = (gondolaSeq[i]+cnt-1)%n+1, cnt++;
		break;
	}
	vector<pair<int,int>> A;
	for (int i = 0; i < n; i++)
		A.push_back({gondolaSeq[i],i});
	sort(A.begin(),A.end());
	int l = 0, now = n+1;
	for (auto it : A){
		int i = it.second;
		if (gondolaSeq[i] <= n)
			continue;
		while (now <= gondolaSeq[i])
			replacementSeq[l++] = p[i], p[i] = now++;
	}
	return l;
}

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

int countReplacement(int n, int inputSeq[])
{
	return -3;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Correct 6 ms 512 KB Output is correct
7 Correct 15 ms 896 KB Output is correct
8 Correct 10 ms 640 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 12 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 5 ms 512 KB Output is correct
7 Correct 12 ms 768 KB Output is correct
8 Correct 10 ms 640 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 13 ms 768 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
12 Correct 1 ms 384 KB Output is correct
13 Correct 7 ms 640 KB Output is correct
14 Correct 0 ms 384 KB Output is correct
15 Correct 18 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Correct 15 ms 2552 KB Output is correct
12 Correct 17 ms 2680 KB Output is correct
13 Correct 18 ms 1640 KB Output is correct
14 Correct 22 ms 2552 KB Output is correct
15 Correct 30 ms 2528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -