제출 #947220

#제출 시각아이디문제언어결과실행 시간메모리
947220Nhoksocqt1Radio Towers (IOI22_towers)C++17
컴파일 에러
0 ms0 KiB
#ifndef Nhoksocqt1 #include "tower.h" #endif // Nhoksocqt1 #include<bits/stdc++.h> using namespace std; #define inf 0x3f3f3f3f #define sz(x) int((x).size()) #define fi first #define se second typedef long long ll; typedef pair<int, int> ii; template<class X, class Y> inline bool maximize(X &x, const Y &y) {return (x < y ? x = y, 1 : 0);} template<class X, class Y> inline bool minimize(X &x, const Y &y) {return (x > y ? x = y, 1 : 0);} mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int Random(int l, int r) { return uniform_int_distribution<int>(l, r)(rng); } const int MAXN = 100005; int dp[MAXN]; int h[MAXN], nArr; void init(int _N, vector<int> _H) { nArr = _N; for (int i = 1; i <= nArr; ++i) h[i] = _H[i - 1]; } int max_towers(int l, int r, int d) { ++l, ++r; for (int i = l; i <= r; ++i) dp[i] = 1; for (int i = l; i <= r; ++i) { int k(i + 1); for (int j = i + 2; j <= r; ++j) { if(h[k] - d >= max(h[i], h[j])) dp[j] = max(dp[j], dp[i] + 1); if(h[j] > h[k]) k = j; } } int res(0); for (int i = l; i <= r; ++i) res = max(res, dp[i]); return res; } #ifdef Nhoksocqt1 int main(void) { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); #define TASK "towers" if(fopen(TASK".inp", "r")) { freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout); } vector<int> _H; int _N, _Q; cin >> _N; _H.resize(_N); for (int i = 0; i < _N; ++i) cin >> _H[i]; init(_N, _H); cin >> _Q; for (int t = 0; t < _Q; ++t) { int _L, _R, _D; cin >> _L >> _R >> _D; cout << "ANSWER FOR " << _L + 1 << ' ' << _R + 1 << ' ' << _D << ": " << max_towers(_L, _R, _D) << '\n'; } return 0; } #endif // Nhoksocqt1

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

towers.cpp:2:14: fatal error: tower.h: No such file or directory
    2 |     #include "tower.h"
      |              ^~~~~~~~~
compilation terminated.