Submission #1082241

#TimeUsernameProblemLanguageResultExecution timeMemory
1082241jer033Radio Towers (IOI22_towers)C++17
0 / 100
489 ms1880 KiB
#include "towers.h" #include <vector> #include <bits/stdc++.h> using namespace std; const int INF = 2'000'000'000; vector<int> H; int N; vector<int> comm; void init(int n, std::vector<int> h) { H = h; N = n; comm = vector<int> (N-1, 0); for (int i=1; i<(N-1); i++) { comm[i] = comm[i-1]; if ((H[i]<H[i-1]) and (H[i]<H[i+1])) comm[i]++; } } int max_towers(int L, int R, int D) { if ((R-L)<=1) return 1; int ans = comm[R-1]-comm[L+1]; if (H[L] < H[L+1]) ans++; if (H[R] < H[R-1]) ans++; 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...