結果

問題 No.2393 Bit Grid Connected Component
ユーザー momoyuu
提出日時 2023-07-28 21:25:10
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 459 bytes
コンパイル時間 3,020 ms
コンパイル使用メモリ 244,940 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-06 17:29:10
合計ジャッジ時間 4,577 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 13 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    ll t;
    cin>>t;
    while(t--){
        ll x,y;
        cin>>x>>y;
        ll ans = 0;
        ll ni = y;
        while(ni<30){
            if(~x>>ni&1) break;
            ni++;
        }
        ni--;
        while(ni>=0){
            ans += 1ll<<ni;
            ni--;
        }
        cout<<ans<<endl;
    }
}   

0