Submission #626911

#TimeUsernameProblemLanguageResultExecution timeMemory
626911kkkkkkkkRadio Towers (IOI22_towers)C++17
0 / 100
4066 ms1436 KiB
#include <bits/stdc++.h> using namespace std; vector<int> height; int N,k=0; void init(int n,vector<int> H) { N=n; height=H; } int max_towers(int l,int r,int d) { int res=1; for (int i=l;i<=r;i++) { int max_height=0,how_many=1,preth=height[i]; for (int j=i+1;j<=r;j++) { max_height=max(max_height,height[j]); if (max_height-height[j]>=d&&max_height-preth>=d) { how_many++; preth=max(preth,height[j]); if (preth==height[j]) max_height=0; } } res=max(res,how_many); } return res; }
#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...