Submission #1035135

#TimeUsernameProblemLanguageResultExecution timeMemory
1035135NeroZeinRadio Towers (IOI22_towers)C++17
0 / 100
462 ms1900 KiB
#include "towers.h" #include <bits/stdc++.h> using namespace std; const int LOG = 18; int n; vector<int> h; vector<int> pref; void init(int N_, vector<int> H_) { n = N_, h = H_; pref.resize(n - 1); for (int i = 1; i < n - 1; ++i) { pref[i] = (h[i - 1] < h[i]) && (h[i] > h[i + 1]); } for (int i = 1; i < n - 1; ++i) { pref[i] += pref[i - 1]; } } int max_towers(int l, int r, int d) { assert(d == 1); if (l == r) { return 1; } int ans = max(1, pref[r - 1] - pref[l]); return ans; }
#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...