제출 #798465

#제출 시각아이디문제언어결과실행 시간메모리
798465jakobrs송신탑 (IOI22_towers)C++17
0 / 100
4054 ms1360 KiB
#include <vector> #include <iostream> int n; std::vector<int> h; void init(int N, std::vector<int> H) { n = N; h = H; } int max_towers(int L, int R, int D) { if (L == R) return 1; R += 1; std::vector<int> included { h[L] }; int greatest = h[L]; for (int i = L + 1; i < R; i++) { if (h[i] > greatest) { greatest = h[i]; } else if (greatest - included.back() < D) { if (h[i] < included.back()) { included.pop_back(); included.push_back(h[i]); greatest = h[i]; } } else { included.push_back(h[i]); greatest = h[i]; } } return included.size(); }
#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...