Submission #578899

#TimeUsernameProblemLanguageResultExecution timeMemory
578899mousebeaverTwo Antennas (JOI19_antennas)C++14
2 / 100
3057 ms4528 KiB
#define ll long long #define ull unsigned ll #define pii pair<int, int> #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; vector<ll> h(n); //heights vector<pii> a(n); //Bereiche for(int i = 0; i < n; i++) { cin>>h[i]>>a[i].first>>a[i].second; } int q; cin>>q; for(int i = 0; i < q; i++) { int l, r; cin>>l>>r; l--; r--; ll output = -1; for(int j = l; j < r; j++) { for(int k = j+1; k <= r; k++) { if(a[j].first+j <= k && k <= a[j].second+j && k-a[k].first >= j && k-a[k].second <= j) { output = max(output, abs(h[j] - h[k])); } } } cout<<output<<"\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...