Submission #629165

#TimeUsernameProblemLanguageResultExecution timeMemory
629165handlenameRadio Towers (IOI22_towers)C++17
23 / 100
4046 ms1568 KiB
#include <bits/stdc++.h> #include "towers.h" using namespace std; #define pb push_back #define mp make_pair int n,arr[100001]; void init(int N,vector<int> H){ n=N; for (int i=1;i<=n;i++){ arr[i]=H[i-1]; } } int max_towers(int l,int r,int d){ l++; r++; int ans=1,smol=arr[l],tall=arr[l]; for (int i=l+1;i<=r;i++){ if (tall<smol+d){ smol=min(smol,arr[i]); tall=arr[i]; } tall=max(tall,arr[i]); if (tall>=smol+d && tall>=arr[i]+d){ smol=arr[i]; tall=arr[i]; 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...