제출 #411269

#제출 시각아이디문제언어결과실행 시간메모리
411269LouayFarah코끼리 (Dancing Elephants) (IOI11_elephants)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "elephants.h" using namespace std; void init(int n, int l, int x[]); int solve(int n, int l, int x[]) { int len = x[0]; len+=l; int res = 1; for(int j = 1; j<n; j++) { if(x[j]>len) { res++; len+=l; } } return res; } int update(int i, int y) { x[i] = y; int j = i; while(j<n-1) { if(x[i]>x[i+1]) swap(x[i], x[i+1]); else break; j++; } j = i; while(j>0) { if(x[i]<x[i-1]) swap(x[i], x[i-1]); else break; j--; } int res = solve(n, l, x); return res; }

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

elephants.cpp: In function 'int update(int, int)':
elephants.cpp:26:5: error: 'x' was not declared in this scope
   26 |     x[i] = y;
      |     ^
elephants.cpp:28:13: error: 'n' was not declared in this scope
   28 |     while(j<n-1)
      |             ^
elephants.cpp:46:21: error: 'n' was not declared in this scope
   46 |     int res = solve(n, l, x);
      |                     ^
elephants.cpp:46:24: error: 'l' was not declared in this scope
   46 |     int res = solve(n, l, x);
      |                        ^