답안 #31168

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31168 2017-08-12T08:14:13 Z cscandkswon 곤돌라 (IOI14_gondola) C++14
55 / 100
26 ms 4560 KB
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN=100000;
   
int init[MAXN];
     
void settinginit(int n, int seq[]){
 	int i, x=-1;
   	for(i=0; i<n; i++)if(seq[i]<=n){
   		x=(i-seq[i]+1+n)%n;
   		break;
   	}
   	if(x==-1) x=0;
   	for(i=0; i<n; i++, x=(x+1)%n) init[x]=i+1;
}
     
int valid(int n, int inputSeq[]){
    int i;
   	settinginit(n, inputSeq);
   	for(i=0; i<n; i++) if(inputSeq[i]<=n&&inputSeq[i]!=init[i]) return 0;
	sort(inputSeq, inputSeq+n);
    for(i=1; i<n; i++) if(inputSeq[i-1]==inputSeq[i]) return 0;
    return 1;
}
     
pair<int, int> rep[MAXN];
     
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
  	int i, length=0, change=0, last=n+1;
   	settinginit(n, gondolaSeq);
   	for(i=0; i<n; i++) if(gondolaSeq[i]!=init[i])
   		rep[change].first=gondolaSeq[i], rep[change++].second=i;
   	sort(rep, rep+change);
   	for(i=0; i<change; i++){	
   		replacementSeq[length++]=init[rep[i].second];
   		for(; last<rep[i].first; last++) replacementSeq[length++]=last;
   		last=rep[i].first+1;
   	}
   	return length;
}
     
int countReplacement(int n, int inputSeq[])
{
	return -3;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4560 KB Output is correct
2 Correct 0 ms 4560 KB Output is correct
3 Correct 0 ms 4560 KB Output is correct
4 Correct 0 ms 4560 KB Output is correct
5 Correct 0 ms 4560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4560 KB Output is correct
2 Correct 0 ms 4560 KB Output is correct
3 Correct 0 ms 4560 KB Output is correct
4 Correct 0 ms 4560 KB Output is correct
5 Correct 0 ms 4560 KB Output is correct
6 Correct 6 ms 4560 KB Output is correct
7 Correct 13 ms 4560 KB Output is correct
8 Correct 9 ms 4560 KB Output is correct
9 Correct 3 ms 4560 KB Output is correct
10 Correct 9 ms 4560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4560 KB Output is correct
2 Correct 0 ms 4560 KB Output is correct
3 Correct 0 ms 4560 KB Output is correct
4 Correct 0 ms 4560 KB Output is correct
5 Correct 0 ms 4560 KB Output is correct
6 Correct 6 ms 4560 KB Output is correct
7 Correct 9 ms 4560 KB Output is correct
8 Correct 13 ms 4560 KB Output is correct
9 Correct 3 ms 4560 KB Output is correct
10 Correct 16 ms 4560 KB Output is correct
11 Correct 0 ms 4560 KB Output is correct
12 Correct 0 ms 4560 KB Output is correct
13 Correct 3 ms 4560 KB Output is correct
14 Correct 0 ms 4560 KB Output is correct
15 Correct 6 ms 4560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4560 KB Output is correct
2 Correct 0 ms 4560 KB Output is correct
3 Correct 0 ms 4560 KB Output is correct
4 Correct 0 ms 4560 KB Output is correct
5 Correct 0 ms 4560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4560 KB Output is correct
2 Correct 0 ms 4560 KB Output is correct
3 Correct 0 ms 4560 KB Output is correct
4 Correct 0 ms 4560 KB Output is correct
5 Correct 0 ms 4560 KB Output is correct
6 Correct 0 ms 4560 KB Output is correct
7 Correct 0 ms 4560 KB Output is correct
8 Correct 0 ms 4560 KB Output is correct
9 Correct 0 ms 4560 KB Output is correct
10 Correct 0 ms 4560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 4560 KB Output is correct
2 Correct 0 ms 4560 KB Output is correct
3 Correct 0 ms 4560 KB Output is correct
4 Correct 0 ms 4560 KB Output is correct
5 Correct 0 ms 4560 KB Output is correct
6 Correct 0 ms 4560 KB Output is correct
7 Correct 0 ms 4560 KB Output is correct
8 Correct 0 ms 4560 KB Output is correct
9 Correct 0 ms 4560 KB Output is correct
10 Correct 0 ms 4560 KB Output is correct
11 Correct 16 ms 4560 KB Output is correct
12 Correct 13 ms 4560 KB Output is correct
13 Correct 16 ms 4560 KB Output is correct
14 Correct 13 ms 4560 KB Output is correct
15 Correct 26 ms 4560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 4560 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 4560 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 4560 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 4560 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -