結果

問題 No.2393 Bit Grid Connected Component
ユーザー momoyuumomoyuu
提出日時 2023-07-28 21:25:10
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 459 bytes
コンパイル時間 3,663 ms
コンパイル使用メモリ 272,816 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-16 05:14:10
合計ジャッジ時間 4,959 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 10 ms
5,376 KB
testcase_15 AC 12 ms
5,376 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

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