답안 #403919

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
403919 2021-05-13T15:04:44 Z Iwanttobreakfree 곤돌라 (IOI14_gondola) C++
25 / 100
14 ms 1484 KB
#include "gondola.h"
#include <vector>
#include <set>
using namespace std;
int valid(int n, int inputSeq[]){
	int mini=1e9,pos,cont=0;
  for(int i=0;i<n;i++){
  	if(inputSeq[i]<mini){
  		mini=inputSeq[i];
  		pos=i;
	  }
  }
  vector<bool> visto(300000,false);
  vector<int>v(n);
  for(int i=pos;i<n;i++){
  	v[cont]=inputSeq[i];
  	cont++;
  }
  for(int i=0;i<pos;i++){
  	v[cont]=inputSeq[i];
  	cont++;
  }
  for(int i=0;i<n;i++){
  	if(v[i]>n){
  		if(!visto[v[i]])visto[v[i]]=true;
  		else return 0;
	  }
  	if(v[i]-mini!=i)return 0;
  }
  return 1;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[]){
  int maxi=0;
  for(int i=0;i<n;i++){
	if(gondolaSeq[i]>maxi){
		maxi=gondolaSeq[i];
	}
  }
  set<int> s;
  for(int i=1;i<=maxi;i++){
  	s.insert(i);
  }
  for(int i=0;i<n;i++){
  	s.erase(gondolaSeq[i]);
  }
  int cont=0;
  for(int x:s){
  	replacementSeq[cont]=x;
  	cont++;
  }
  return cont;
}
int countReplacement(int n, int inputSeq[]){
  return -3;
}

Compilation message

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:20:11: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |    v[cont]=inputSeq[i];
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 228 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 6 ms 588 KB Output is correct
7 Correct 14 ms 972 KB Output is correct
8 Correct 14 ms 796 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 12 ms 936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 8 ms 588 KB Output is correct
7 Correct 12 ms 988 KB Output is correct
8 Correct 10 ms 844 KB Output is correct
9 Correct 4 ms 460 KB Output is correct
10 Correct 11 ms 972 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 6 ms 588 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 13 ms 1484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Incorrect 1 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Integer -3 violates the range [0, 1000000008]
2 Halted 0 ms 0 KB -