Submission #693017

#TimeUsernameProblemLanguageResultExecution timeMemory
693017PyqeRadio Towers (IOI22_towers)C++17
11 / 100
4067 ms1872 KiB
#include <bits/stdc++.h> #include "towers.h" using namespace std; #define mp make_pair #define fr first #define sc second const long long inf=1e18; long long a[100069]; void init(int n,vector<int> aa) { long long i; for(i=1;i<=n;i++) { a[i]=aa[i-1]; } } int max_towers(int lb,int rb,int cw) { lb++; rb++; if(lb==rb) { return 1; } else { long long i,j,mn,mx,z=rb-lb+1; for(i=lb;i<=rb;i++) { mn=inf; mx=-inf; for(j=i-1;j>=lb;j--) { if(a[j]<a[i]) { break; } mx=max(mx,a[j]); } if(j>=lb) { mn=min(mn,mx); } mx=-inf; for(j=i+1;j<=rb;j++) { if(a[j]<a[i]) { break; } mx=max(mx,a[j]); } if(j<=rb) { mn=min(mn,mx); } if(mn-a[i]<cw) { z--; } } return z; } }
#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...