제출 #403863

#제출 시각아이디문제언어결과실행 시간메모리
403863Iwanttobreakfree곤돌라 (IOI14_gondola)C++98
10 / 100
13 ms1472 KiB
#include "gondola.h" #include <vector> 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<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)continue; if(v[i]-mini!=i)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:18:11: warning: 'pos' may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |    v[cont]=inputSeq[i];
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...