제출 #131956

#제출 시각아이디문제언어결과실행 시간메모리
131956Lord_ZebellakTwo Antennas (JOI19_antennas)C++14
2 / 100
3034 ms5472 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef std::vector<ll> vi; typedef pair < ll , ll > pll; #define pb push_back #define mp make_pair ll mx(ll a , ll b){ if (a > b) return a; return b; } ll mod (ll x ){ if (x % 998244353 < 0) return(mod (x + 998244353)); return x % 998244353 ; } ll pw(ll x , ll p){ ll r = 1; while (p > 0){ if (p & 1){ r *= x; r = mod(r); p --; } x *= x; x = mod(x); p /= 2; } return r; } ll n , q; vi hi , ai , bi; void solve(ll l , ll r){ ll res = -1; for (ll i = l ; i <= r ; i ++){ for (ll j = i + 1 ; j <= r ; j ++){ ll d = j - i; if (d >= ai[i-1] and bi[i-1] >= d and d >= ai[j-1] and bi[j-1] >= d){ res = mx(abs(hi[i-1]-hi[j-1]) , res); } } } cout << res << endl; } int main(){ cin >> n; for (ll i = 0 ; i < n ; i ++){ ll h , a , b; cin >> h >> a >> b; hi.pb(h); ai.pb(a); bi.pb(b); } cin >> q; for (ll i = 0 ; i < q ; i ++){ ll l , r; cin >> l >> r; solve(l , r); } 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...