Submission #1035270

#TimeUsernameProblemLanguageResultExecution timeMemory
1035270NeroZeinRadio Towers (IOI22_towers)C++17
0 / 100
4043 ms1368 KiB
#include "towers.h" #include <bits/stdc++.h> using namespace std; int n; vector<int> h; void init(int N_, vector<int> H_) { n = N_, h = H_; } int max_towers(int l, int r, int d) { int lst = l - 1; int good_towers = 0; for (int i = l + 1; i < r; ++i) { if (h[i] < h[i - 1] || h[i] < h[i + 1]) { continue; } int mn = h[lst + 1]; for (int j = lst + 1; j < i; ++j) { mn = min(mn, h[j]); } if (h[i] - mn >= d) { lst = i; good_towers++; } } return good_towers + 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...