Submission #1058526

#TimeUsernameProblemLanguageResultExecution timeMemory
1058526Jarif_RahmanTwo Antennas (JOI19_antennas)C++17
2 / 100
3051 ms3164 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<ll> H(n); vector<int> A(n), B(n); for(int i = 0; i < n; i++) cin >> H[i] >> A[i] >> B[i]; int q; cin >> q; while(q--){ int l, r; cin >> l >> r; l--, r--; ll ans = -1; for(int i = l; i <= r; i++) for(int j = i+1; j <= r; j++){ if(j >= i+A[i] && j <= i+B[i] && i >= j-B[j] && i <= j-A[j]) ans = max(ans, abs(H[i]-H[j])); } cout << ans << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...