제출 #403853

#제출 시각아이디문제언어결과실행 시간메모리
403853Iwanttobreakfree곤돌라 (IOI14_gondola)C++98
컴파일 에러
0 ms0 KiB
#include "gondola.h"
#include <vector>
using namespace std;
int valid(int n, int inputSeq[]){
	int mini=1e9;
  for(int i=0;i<n;i++){
  	if(inputSeq[i]<mini){
  		mini=inputSeq[i];
  		pos=i;
	  }
  }
  vector<int>v(n);
  for(int i=pos;i<n;i++){
  	v[i-pos]=inputSeq[i];
  }
  for(int i=0;i<pos;i++){
  	v[i+pos]=inputSeq[i];
  }
  for(int i=0;i<n;i++){
  	if(v[i]>n)continue;
  	if(v[i]-mini!=pos)return 0;
  }
  return 1;
}

int replacement(int n, int gondolaSeq[], int replacementSeq[]){
  return -2;
}
int countReplacement(int n, int inputSeq[]){
  return -3;
}

컴파일 시 표준 에러 (stderr) 메시지

gondola.cpp: In function 'int valid(int, int*)':
gondola.cpp:9:5: error: 'pos' was not declared in this scope
    9 |     pos=i;
      |     ^~~
gondola.cpp:13:13: error: 'pos' was not declared in this scope
   13 |   for(int i=pos;i<n;i++){
      |             ^~~
gondola.cpp:16:17: error: 'pos' was not declared in this scope
   16 |   for(int i=0;i<pos;i++){
      |                 ^~~
gondola.cpp:21:18: error: 'pos' was not declared in this scope
   21 |    if(v[i]-mini!=pos)return 0;
      |                  ^~~