Submission #1083820

#TimeUsernameProblemLanguageResultExecution timeMemory
1083820SamueleVidRadio Towers (IOI22_towers)C++17
4 / 100
688 ms1368 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long constexpr int MAXN = 1e5; constexpr int PW = 131072; vector<int> H; int k; void init(int N, vector<int> H) { :: H = H; k = 0; for (int i = 0; i < N - 1; i ++) { if (H[i] < H[i + 1]) k = i + 1; } } int max_towers(int L, int R, int D) { if (L >= k || R <= k) return 1; int dx = k - 1; for (int p = PW; p >= 1; p /= 2) { if (p + dx <= R && H[p + dx] > H[k] - D) dx += p; } dx ++; int sx = k + 1; for (int p = PW; p >= 1; p /= 2) { if (sx - p >= L && H[sx - p] > H[k] - D) sx -= p; } sx --; if (sx >= L && dx <= R) return 2; return 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...