#include #define rep(i,n) for (int i=0; i < (int)(n); i++) #define all(c) c.begin(), c.end() using namespace std; typedef long long ll; typedef long double ld; using vi = vector; using vvi = vector; using vl = vector; using vvl = vector; using P = pair; ll solve() { //答えはmax120程度 //BFS書けないか? ->断念。どん欲へ ll sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty; if(sy > 60 || ty > 60) return abs(sy - ty); //y>60なら左端マスがxの全範囲をカバー //x座標は左端に寄せる { ll dx = 1LL << sy; sx -= sx % dx; } { ll dx = 1LL << ty; tx -= tx % dx; } //sy > ty if(sy < ty) swap(sx,tx), swap(sy,ty); //ゴールから直上に上がるケースを事前に格納 vl gx(61,0); //goal x { ll x = tx, y = ty; ll dx = 1LL<>T; rep(i,T) cout<