제출 #1250781

#제출 시각아이디문제언어결과실행 시간메모리
1250781hmms127Gondola (IOI14_gondola)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "gondola.h" #define pb push_back using namespace std; int valid(int n, int a[]) { int idx; for(int i=0;i<n;i++){ if(a[i]==1){idx=i;break;} } int sm=0; for(int i=idx;i<n;i++)sm+=a[i]; int sz=n-idx; return (sm==sz*(sz+1)/2); } //---------------------- int replacement(int n, int gondolaSeq[], int replacementSeq[]) { int frq[n+1]={}; for(int i=0;i<n;i++)frq[a[i]]++; for(int i=1;i<=n;i++){ if(frq[a[i]]==0){ replacementSeq[0]=i; break; } } return 1; } //---------------------- int countReplacement(int n, int inputSeq[]) { return -3; }

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

gondola.cpp: In function 'int replacement(int, int*, int*)':
gondola.cpp:23:27: error: 'a' was not declared in this scope
   23 |   for(int i=0;i<n;i++)frq[a[i]]++;
      |                           ^
gondola.cpp:25:14: error: 'a' was not declared in this scope
   25 |       if(frq[a[i]]==0){
      |              ^