Submission #735621

#TimeUsernameProblemLanguageResultExecution timeMemory
735621math_rabbit_1028Radio Towers (IOI22_towers)C++17
14 / 100
1177 ms1992 KiB
#include "towers.h" #include <bits/stdc++.h> using namespace std; int n; vector<int> arr; int cnt[101010]; void init(int N, vector<int> H) { n = N; for (int i = 0; i < N; i++) arr.push_back(H[i]); cnt[0] = 0; for (int i = 1; i < N - 1; i++) { if (arr[i] > arr[i - 1] && arr[i] > arr[i + 1]) cnt[i] = cnt[i - 1] + 1; else cnt[i] = cnt[i - 1]; } } int max_towers(int L, int R, int D) { return max(cnt[R - 1] - cnt[L], 0) + 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...