Submission #692966

#TimeUsernameProblemLanguageResultExecution timeMemory
692966PyqeRadio Towers (IOI22_towers)C++17
14 / 100
884 ms2728 KiB
#include <bits/stdc++.h> #include "towers.h" using namespace std; long long a[100069],ps[100069]; void init(int n,vector<int> aa) { long long i; for(i=1;i<=n;i++) { a[i]=aa[i-1]; } for(i=1;i<=n;i++) { ps[i]=ps[i-1]+(i>1&&i<n&&a[i]<a[i-1]&&a[i]<a[i+1]); } } int max_towers(int lb,int rb,int cw) { lb++; rb++; if(lb==rb) { return 1; } else { return ps[rb-1]-ps[lb]+(a[lb]<a[lb+1])+(a[rb]<a[rb-1]); } }
#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...