結果

問題 No.822 Bitwise AND
ユーザー yoshnaryyoshnary
提出日時 2019-04-26 22:29:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,055 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 761 ms
コンパイル使用メモリ 91,820 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 01:10:58
合計ジャッジ時間 14,165 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,055 ms
4,380 KB
testcase_01 AC 25 ms
4,376 KB
testcase_02 AC 7 ms
4,380 KB
testcase_03 AC 13 ms
4,380 KB
testcase_04 AC 1,053 ms
4,376 KB
testcase_05 AC 508 ms
4,380 KB
testcase_06 AC 913 ms
4,376 KB
testcase_07 AC 1,051 ms
4,376 KB
testcase_08 AC 1,051 ms
4,376 KB
testcase_09 AC 907 ms
4,380 KB
testcase_10 AC 1,011 ms
4,376 KB
testcase_11 AC 1,048 ms
4,376 KB
testcase_12 AC 1,021 ms
4,376 KB
testcase_13 AC 7 ms
4,376 KB
testcase_14 AC 1,052 ms
4,376 KB
testcase_15 AC 588 ms
4,380 KB
testcase_16 AC 13 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <cassert>
using namespace std;
using ll = long long;

int main() {
	int n, k; cin >> n >> k;
	ll ans = 0;
	int ma = 0;
	for (int x = 0; x < 3000000; x++) {
		for (int y = max(0, x - k); y <= x; y++) {
			if ((x&y) == n) ans++, ma = max(ma, x);
		}
	}
	if (ma >= 2000000) cout << "INF" << endl;
	else cout << ans << endl;
	return 0;
}
0