제출 #723056

#제출 시각아이디문제언어결과실행 시간메모리
723056josanneo22Radio Towers (IOI22_towers)C++17
컴파일 에러
0 ms0 KiB
//#include "towers.h" #include <vector> #include<bits/stdc++.h> using namespace std; int mx=-1; vector<int> h; void init(int N, std::vector<int> H) { h=H; for(int i=1;i<N-1;i++){ if(h[k]>h[k-1] && h[i]>h[i+1]) mx=i; } } int max_towers(int L, int R, int D) { if(l>=mx || r<=mx) return 1; else{ if(h[l]+D<=h[mx] && h[r]+D<=h[mx]) return 2; else return 1; } }

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

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:10:8: error: 'k' was not declared in this scope
   10 |   if(h[k]>h[k-1] && h[i]>h[i+1]) mx=i;
      |        ^
towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:15:5: error: 'l' was not declared in this scope
   15 |  if(l>=mx || r<=mx) return 1;
      |     ^
towers.cpp:15:14: error: 'r' was not declared in this scope
   15 |  if(l>=mx || r<=mx) return 1;
      |              ^
towers.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
   20 | }
      | ^