제출 #1323381

#제출 시각아이디문제언어결과실행 시간메모리
1323381hynmj곤돌라 (IOI14_gondola)C++20
컴파일 에러
0 ms0 KiB
#include "gondola.h" #include <bits/stdc++.h> using namespace std; int valid(int n, int a[]) { set<int> s; for (int i = 0; i < n; i++) { a[i]--; s.insert(a[i]); } if (s.size() != n) return 0; int j = 0; bool ok = 1; for (int i = 0; i < n; i++) { if (a[i] < n) { ok = 0; j = (i - a[i] + n) % n; break; } } if (ok) return 1; for (int k = 0; k < n; k++, j++) { if (a[i] < n && a[i] != k) { 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:29:11: error: 'i' was not declared in this scope
   29 |     if (a[i] < n && a[i] != k)
      |           ^