Submission #635068

#TimeUsernameProblemLanguageResultExecution timeMemory
635068phathnvRadio Towers (IOI22_towers)C++17
0 / 100
4038 ms1440 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 res = 1, last = h[l]; for (int i = l + 1; i <= r; ++i) { if (res & 1) { if (h[i] >= last + d) { ++res; last = h[i]; } else { last = min(last, h[i]); } } else { if (h[i] + d <= last) { ++res; last = h[i]; } else { last = min(last, h[i]); } } } return (res + 1) / 2; }
#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...