답안 #785255

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
785255 2023-07-17T07:41:23 Z ono_de206 송신탑 (IOI22_towers) C++17
컴파일 오류
0 ms 0 KB
#include "towers.h"
#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

//#define int long long
 
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

const int mxn = 1e5 + 10;
int h[mxn], n, pos;
void init(int _n, vector<int> H) {
	n = _n
	for(int i = 1; i <= n; i++) {
		h[i] = H[i - 1];
	}
	for(int i = 2; i < n; i++) {
		if(h[i] > max(h[i - 1], h[i + 1])) pos = i;
	}
}

int max_towers(int L, int R, int D) {
	L++;
	R++;
	return (L < pos && R > pos && max(h[L], h[R]) <= h[pos] - D);
}

Compilation message

towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:24:8: error: expected ';' before 'for'
   24 |  n = _n
      |        ^
      |        ;
   25 |  for(int i = 1; i <= n; i++) {
      |  ~~~    
towers.cpp:25:17: error: 'i' was not declared in this scope
   25 |  for(int i = 1; i <= n; i++) {
      |                 ^