Submission #659092

#TimeUsernameProblemLanguageResultExecution timeMemory
659092AlenygamRadio Towers (IOI22_towers)C++17
4 / 100
919 ms1872 KiB
#include "towers.h" #include <bits/stdc++.h> using namespace std; int N; vector<pair<int, int>> H; int k; void init(int N, vector<int> H) { ::N = N; ::H.resize(N); for (int i = 0; i < N; i++) { ::H[i].first = H[i]; ::H[i].second = i; } if (N == 2) { if (H[0] > H[1]) k = 0; else k = 1; } for (int i = 1; i < N - 1; i++) { if (H[i - 1] < H[i] && H[i] > H[i - 1]) k = i; } } int max_towers(int L, int R, int D) { if (k >= L && k <= R) { int lf = H[L].first; int rg = H[R].first; int ma = max(lf, rg); if (H[k].first - ma >= D) return 2; return 1; } else { 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...