Submission #838631

#TimeUsernameProblemLanguageResultExecution timeMemory
838631erekleRadio Towers (IOI22_towers)C++17
14 / 100
773 ms1836 KiB
#include "towers.h" #include <vector> #include <algorithm> using namespace std; int n; vector<int> H, prefixLocalMX; void init(int N, vector<int> Hs) { n = N, H = Hs; prefixLocalMX.resize(1+n); for (int i = 1; i < n-1; ++i) { prefixLocalMX[i+1] += prefixLocalMX[i]; if (H[i] > H[i-1] && H[i] > H[i+1]) ++prefixLocalMX[i+1]; } } int max_towers(int L, int R, int D) { // case D = 1 return 1+max(0, prefixLocalMX[R] - prefixLocalMX[L+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...