提出 #70106419


ソースコード 拡げる

#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
//using namespace atcoder;
//using mint = modint1000000007;
//const int mod = 1000000007;
//using mint = modint998244353;
//const int mod = 998244353;
//const int INF = 1e9;
//const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i,l,r)for(int i=(l);i<(r);++i)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; --i)
#define rrep2(i,l,r)for(int i=(r) - 1;i>=(l);--i)
#define all(x) (x).begin(),(x).end()
#define allR(x) (x).rbegin(),(x).rend()
#define P pair<int,int>
template<typename A, typename B> inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; }

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int t; cin >> t;
	while (t--) {
		int c, x; cin >> c >> x;
		vector<long long>th = { c^x,(1ll << 50) + (c - x) / 2 };
		long long ans = -1;
		for (auto n : th) {
			if (n == 0)continue;
			if ((n^c) % n == x)ans = n;
		}
		cout << ans << endl;
	}
	return 0;
}

提出情報

提出日時
問題 C - Mod of XOR
ユーザ kwm_t
言語 C++ 23 (gcc 12.2)
得点 700
コード長 1191 Byte
結果 AC
実行時間 223 ms
メモリ 3876 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 700 / 700
結果
AC × 1
AC × 22
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3412 KiB
01_handmade_00.txt AC 218 ms 3520 KiB
01_handmade_01.txt AC 217 ms 3472 KiB
01_handmade_02.txt AC 216 ms 3412 KiB
01_handmade_03.txt AC 212 ms 3464 KiB
01_handmade_04.txt AC 223 ms 3828 KiB
01_handmade_05.txt AC 223 ms 3876 KiB
02_random_00.txt AC 221 ms 3420 KiB
02_random_01.txt AC 220 ms 3392 KiB
02_random_02.txt AC 222 ms 3424 KiB
02_random_03.txt AC 222 ms 3420 KiB
02_random_04.txt AC 221 ms 3596 KiB
02_random_05.txt AC 217 ms 3424 KiB
02_random_06.txt AC 217 ms 3416 KiB
02_random_07.txt AC 217 ms 3320 KiB
02_random_08.txt AC 222 ms 3428 KiB
02_random_09.txt AC 223 ms 3472 KiB
02_random_10.txt AC 221 ms 3280 KiB
02_random_11.txt AC 223 ms 3812 KiB
02_random_12.txt AC 222 ms 3860 KiB
02_random_13.txt AC 222 ms 3796 KiB
02_random_14.txt AC 221 ms 3448 KiB