Submission #651013

#TimeUsernameProblemLanguageResultExecution timeMemory
651013NaimSSRadio Towers (IOI22_towers)C++17
14 / 100
910 ms2236 KiB
#include "towers.h" #include <bits/stdc++.h> #define pb push_back using namespace std; #include <vector> const int N = 100100; int cnt[N]; int h[N]; vector<int> pos; #define pico ahiusuhashuis vector<int> pico; int good[N]; void init(int N, std::vector<int> H) { for(int i=0;i<N;i++)h[i] = H[i]; for(int i=0;i<N;i++){ int l = (i == 0 || H[i] < H[i-1]); int r = (i == N-1 || H[i] < H[i+1]); if(l && r){ cnt[i]++; good[i]=1; } if(i)cnt[i]+=cnt[i-1]; } } int max_towers(int L, int R, int D) { if(L==R)return 1; int qtd = cnt[R] - (L>0?cnt[L-1]:0); if(h[L] < h[L+1] && !good[L])qtd++; if(h[R] < h[R-1] && !good[R])qtd++; return max(1,qtd); }
#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...