제출 #348638

#제출 시각아이디문제언어결과실행 시간메모리
348638tengiz05코끼리 (Dancing Elephants) (IOI11_elephants)C++17
컴파일 에러
0 ms0 KiB
#include "elephants.h" #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> using namespace std; int len, a[50000]; set<int> s; void init(int N, int L, int X[]){ len = L; for(int i=0;i<n;i++)a[i] = X[i]; for(int i=0;i<n;i++)s.insert(a[i]); } int update(int i, int y){ int ans = 1; s.erase(a[i]); a[i] = y; s.insert(a[i]); int lst=*s.begin(); int tmp=lst; s.erase(tmp); for(const int &x : s) if(x-lst > len) ans++,lst=x; s.insert(tmp); return ans; }

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

elephants.cpp: In function 'void init(int, int, int*)':
elephants.cpp:11:16: error: 'n' was not declared in this scope
   11 |  for(int i=0;i<n;i++)a[i] = X[i];
      |                ^
elephants.cpp:12:16: error: 'n' was not declared in this scope
   12 |  for(int i=0;i<n;i++)s.insert(a[i]);
      |                ^