Submission #829459

#TimeUsernameProblemLanguageResultExecution timeMemory
829459tolbiRadio Towers (IOI22_towers)C++17
0 / 100
4030 ms1360 KiB
#include "towers.h" #include <bits/stdc++.h> using namespace std; #include <vector> vector<int> arr; int n; int st; void init(int N, std::vector<int> H) { arr=H; n=N; for (int i = 0; i < N; i++){ if (H[i]<H[st]) st=i; } } int max_towers(int L, int R, int D) { int mava = -23; int ans = 1; int nmiva = arr[st]; for (int i = st+1; i < n; i++){ if (mava>=nmiva+D && mava>=arr[i]+D){ mava=-23; ans++; nmiva=max(nmiva,arr[i]); } mava=max(mava,arr[i]); } mava=-23; for (int i = st-1; i >= 0; i--){ if (mava>=nmiva+D && mava>=arr[i]+D){ mava=-23; ans++; nmiva=max(nmiva,arr[i]); } mava=max(mava,arr[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...