Submission #1234554

#TimeUsernameProblemLanguageResultExecution timeMemory
1234554Ghulam_Junaid송신탑 (IOI22_towers)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "towers.h" using namespace std; int k; vector<int> a; void init(int n, vector<int> h) { a = h; k = 0; while (k + 1 < n and h[k] < h[k + 1]) k++; } int max_towers(int L, int R, int D) { return 1 + (L < k and k < R and h[R] + D <= h[k] and h[L] + D <= h[k]); }

Compilation message (stderr)

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:15:37: error: 'h' was not declared in this scope
   15 |     return 1 + (L < k and k < R and h[R] + D <= h[k] and h[L] + D <= h[k]);
      |                                     ^