結果
問題 | No.2393 Bit Grid Connected Component |
ユーザー |
|
提出日時 | 2023-07-30 16:46:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 238 ms / 2,000 ms |
コード長 | 2,508 bytes |
コンパイル時間 | 1,812 ms |
コンパイル使用メモリ | 171,892 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-09 11:58:58 |
合計ジャッジ時間 | 3,612 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 20 |
ソースコード
// STLのインクルード#include <bits/stdc++.h>using namespace std;// // ACLのインクルード(デフォルトはコメントアウト)// #include <atcoder/all>// using namespace atcoder;// for文の略記#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define per(i, n) for (int i = (int)(n-1); i >= 0; i--)// vectorのソート#define all(x) x.begin(), x.end()// 型の略記 (競プロならでは)using ll = long long;using pii = pair<int, int>;using pll = pair<long long, long long>;using vi = vector<int>;using vl = vector<long long>;using vs = vector<string>;using vc = vector<char>;using vpii = vector<pair<int, int>>;using vpll = vector<pair<long long, long long>>;using vpsi = vector<pair<string, int>>;using vvi = vector<vector<int>>;using vvpii = vector<vector<pair<int, int>>>;using vvl = vector<vector<long long>>;using vvc = vector<vector<char>>;// MOD計算で使う#define MOD 1000000007#define MOD2 998244353// YES-NOで答える質問で使う(fがTrueならYes)void cout_yn(bool f){if(f)cout << "Yes" << endl;else cout << "No" << endl;}// 木の前順走査void dfs_preorder(int v, vvi &tree, vi &output){output.push_back(v);rep(i, tree[v].size()){dfs_preorder(tree[v][i], tree, output);}}// 木の後順走査void dfs_postorder(int v, vvi &tree, vi &output){rep(i, tree[v].size()){dfs_preorder(tree[v][i], tree, output);}output.push_back(v);}// n頂点m辺の無向グラフを隣接リストで受け取る.// 頂点番号は1-indexedとして入力される想定.vector<vector<int>> input_undir_graph(int n, int m){int a, b;vector<vector<int>> g(n);rep(i, m){cin >> a >> b;a--, b--;g[a].push_back(b); // a->b へ向かう辺g[b].push_back(a); // b->a へ向かう辺}return g;}// n頂点m辺の有向グラフを隣接リストで受け取る.// 頂点番号は1-indexedとして入力される想定.vector<vector<int>> input_dir_graph(int n, int m){int a, b;vector<vector<int>> g(n);rep(i, m){cin >> a >> b;a--, b--;g[a].push_back(b); // a->b へ向かう辺}return g;}// main関数int main(void){int t;cin >> t;rep(_, t){ll x, y;cin >> x >> y;if((x>>y) & 1){while((x>>y) & 1)y++;cout << (1LL<<y) -1 << endl;}else cout << 0 << endl;}return 0;}