Submission #72403157


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void cppio(){ ios_base::sync_with_stdio(0); cin.tie(0); }
template<typename T,typename U>
istream& operator>>(istream& i, pair<T,U>& p) { i >> p.first >> p.second; return i; }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define sz(x) (int)(x).size()
#define XY(t) t.x, t.y

void Work(int tci) {
    int c, x; cin >> c >> x;
    
    ll ans = -1;
    auto f = [&](ll n) {
        if (n) if ((n^c)%n == x) ans = n;
    };

    f(c^x);

    if ((c-x) >= 0 && (c-x)%2 == 0 && (((c-x)/2) & (~c)) == 0)
        f((c-x)/2 + (1ll<<40));

    cout << ans << '\n';
}

int main()
{
    cppio();
    int tc; cin >> tc; rrep(tci, tc) Work(tci);
	return 0;
}

Submission Info

Submission Time
Task C - Mod of XOR
User Namnamseo
Language C++23 (GCC 15.2.0)
Score 700
Code Size 969 Byte
Status AC
Exec Time 27 ms
Memory 3708 KiB

Compile Error

./Main.cpp: In function 'void Work(int)':
./Main.cpp:19:15: warning: unused parameter 'tci' [-Wunused-parameter]
   19 | void Work(int tci) {
      |           ~~~~^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 1
AC × 22
Set Name Test Cases
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
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3608 KiB
01_handmade_00.txt AC 24 ms 3624 KiB
01_handmade_01.txt AC 22 ms 3608 KiB
01_handmade_02.txt AC 23 ms 3472 KiB
01_handmade_03.txt AC 19 ms 3620 KiB
01_handmade_04.txt AC 25 ms 3632 KiB
01_handmade_05.txt AC 25 ms 3548 KiB
02_random_00.txt AC 25 ms 3576 KiB
02_random_01.txt AC 26 ms 3648 KiB
02_random_02.txt AC 27 ms 3564 KiB
02_random_03.txt AC 26 ms 3576 KiB
02_random_04.txt AC 26 ms 3648 KiB
02_random_05.txt AC 23 ms 3548 KiB
02_random_06.txt AC 23 ms 3560 KiB
02_random_07.txt AC 23 ms 3708 KiB
02_random_08.txt AC 27 ms 3668 KiB
02_random_09.txt AC 27 ms 3564 KiB
02_random_10.txt AC 27 ms 3548 KiB
02_random_11.txt AC 25 ms 3620 KiB
02_random_12.txt AC 25 ms 3632 KiB
02_random_13.txt AC 25 ms 3632 KiB
02_random_14.txt AC 24 ms 3632 KiB