結果

問題 No.2393 Bit Grid Connected Component
ユーザー 河城白露
提出日時 2023-07-28 21:40:33
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 641 ms
コンパイル使用メモリ 82,116 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-06 18:03:59
合計ジャッジ時間 1,785 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#define ll long long
#define db double
using namespace std;
ll tt,x,y;
void solve() {
	scanf("%lld%lld",&y,&x);
	ll val = 1;
	while(x > 0) {
		x--;
		val *= 2;
	}
	while(true) {
		if (y & (val * 2)) {
			val *= 2;
		} else {
			break;
		}
	}
	printf("%lld\n",2 * val - 1);
}
int main() {
	scanf("%lld",&tt);
	while(tt) {
		solve();
		tt--;
	}
	return 0;
}
0