제출 #132037

#제출 시각아이디문제언어결과실행 시간메모리
132037bkinikTwo Antennas (JOI19_antennas)C++14
2 / 100
3018 ms4760 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back #define pob pop_back #define st first #define nd second #define test cout<<"test"<<endl; #define mp make_pair typedef long long ll; typedef long double ld; typedef pair<ll,ll> pll; ll INF = 1e9; ll mod = 1e9+7; ll n,m,k,l,r,ans; ll min(ll a, ll b) { return (a<b)? a:b; } ll max(ll a, ll b) { return a+b-min(a,b); } ll q; int main() { //freopen("input","r",stdin); cin>>n; vector<pair<ll,pll> > ants; ants.resize(n); for(int i=0; i<n; i++) { cin>>ants[i].st>>ants[i].nd.st>>ants[i].nd.nd; } cin>>q; for(int i=0; i<q; i++) { cin>>l>>r; l--; r--; m = -1; for(int j=l; j<=r; j++) { for(int k=j+1; k<=r; k++) { if(abs(j-k) >= ants[j].nd.st and abs(j-k) <= ants[j].nd.nd and abs(j-k) <= ants[k].nd.nd and abs(j-k) >= ants[k].nd.st) { m = max(m , abs(ants[j].st - ants[k].st)); } } } cout<<m<<endl; } 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...