제출 #1267378

#제출 시각아이디문제언어결과실행 시간메모리
1267378Faggi송신탑 (IOI22_towers)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; ll n; vector<int>h; vector<ll>v; void init(int N, std::vector<int> H) { h=H; v.resize(N,0); n=N; ll i; for(i=1; i<N; i++) { v[i]=v[i-1]; if(i+1<N&&H[i]<H[i+1]&&H[i]<H[i-1]) v[i]++; } } bool in=0; void ini(ll D) { in=1; ll i; for(i=1; i<N; i++) { v[i]=v[i-1]; if(i+1<N&&H[i]<=H[i+1]-D&&H[i]<=H[i-1]-D) v[i]++; } } int max_towers(int L, int R, int D) { if(in==0) ini(D); if(L==R) return 1; int ans=v[R-1]-v[L]; if(h[L]<=h[L+1]-D) ans++; if(h[R]<=h[R-1]-D) ans++; return ans; }

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

towers.cpp: In function 'void ini(long long int)':
towers.cpp:27:16: error: 'N' was not declared in this scope
   27 |     for(i=1; i<N; i++)
      |                ^
towers.cpp:30:19: error: 'H' was not declared in this scope
   30 |         if(i+1<N&&H[i]<=H[i+1]-D&&H[i]<=H[i-1]-D)
      |                   ^