Submission #1056629

#TimeUsernameProblemLanguageResultExecution timeMemory
1056629AmirAli_H1Radio Towers (IOI22_towers)C++17
4 / 100
611 ms1880 KiB
// In the name of Allah #include <bits/stdc++.h> #include "towers.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define F first #define S second #define all(x) (x).begin(),(x).end() #define len(x) ((ll) (x).size()) #define Mp make_pair #define pb push_back #define endl '\n' #define sep ' ' const int maxn = 1e5 + 7; const ll oo = 1e9 + 7; int n, j; ll A[maxn]; void init(int N, vector<int> H) { n = N; for (int i = 0; i < n; i++) A[i] = H[i]; j = max_element(A, A + n) - A; } int max_towers(int L, int R, int D) { if (j >= L && j <= R) { if (A[L] <= A[j] - D && A[R] <= A[j] - D) return 2; else 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...