結果
問題 |
No.2393 Bit Grid Connected Component
|
ユーザー |
|
提出日時 | 2023-07-29 06:33:49 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 236 ms / 2,000 ms |
コード長 | 623 bytes |
コンパイル時間 | 2,153 ms |
コンパイル使用メモリ | 194,572 KB |
最終ジャッジ日時 | 2025-02-15 20:53:53 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 20 |
ソースコード
typedef long long ll; typedef long double ld; #include <bits/stdc++.h> using namespace std; #define int long long ll isqrt(ll N){ ll sqrtN=sqrt(N)-1; while(sqrtN+1<=N/(sqrtN+1))sqrtN++; return sqrtN; } signed main(){ ll t; std::cin >> t; for (int ii = 0; ii < t; ii++) { ll x,y; std::cin >> x>>y; if(x&(1ll<<y)){ ll ma = y; while(x&(1ll<<(y+1))){ y++; ma = y; } std::cout << (1ll<<(ma+1))-1 << std::endl; }else{ std::cout << 0 << std::endl; continue; } } }