제출 #441252

#제출 시각아이디문제언어결과실행 시간메모리
441252Christopher_Rdz곤돌라 (IOI14_gondola)C++14
0 / 100
1 ms204 KiB
#include "gondola.h" #include <assert.h> #include <stdio.h> #include <bits/stdc++.h> bool visited[250001]; int valid(int n, int inputSeq[]) { int index, aux, valor = 1; for (int i = 0; i < n; i++){ aux = inputSeq[i]; if (aux <= n){ index = i; valor = aux; break; } } for (int i = index; i < n + index; i++){ if (visited[i % n]) return 0; visited[ inputSeq[i % n] ] = true; if (inputSeq[i % n] > n){ valor = (valor % n) + 1; continue; } if (inputSeq[i % n] != valor) return 0; valor = (valor % n) + 1; } 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:19:31: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |     for (int i = index; i < n + index; 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...