Submission #625461

#TimeUsernameProblemLanguageResultExecution timeMemory
625461model_codeRadio Towers (IOI22_towers)C++17
23 / 100
4064 ms1576 KiB
// time_limit/solution-amnu-linear.cpp #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 last = L, ans = 1; bool up = true; for (int i = L; i <= R; i++) { if (up) { if (H[i] >= H[last] + D) { up = false; last = i; } if (H[i] < H[last]) { last = i; } } else { if (H[i] <= H[last] - D) { up = true; last = i; ans++; } if (H[i] > H[last]) { last = i; } } } 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...