Submission #1024744

#TimeUsernameProblemLanguageResultExecution timeMemory
1024744tolbiTwo Antennas (JOI19_antennas)C++17
2 / 100
3050 ms6480 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n;cin>>n; vector<array<int,3>> arr(n); for (int i = 0; i < n; ++i) { for (int j = 0; j < 3; ++j){ cin>>arr[i][j]; } } int q;cin>>q; while (q--){ int l,r;cin>>l>>r; int ans = -1; for (int i = l-1; i <= r-1; i++){ for (int j = l-1; j < i; j++){ if (i-j<=min(arr[i][2],arr[j][2]) && i-j>=max(arr[i][1],arr[j][1])){ ans=max(ans,abs(arr[i][0]-arr[j][0])); } } } cout<<ans<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...