Rating changes for the last round are temporarily rolled back. They will be returned soon. ×

 
 
 
 
General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
128071115 Practice:
ssvb
1567B - 36 GNU C++17 (64) Accepted 623 ms 4212 KB 2021-09-06 20:47:38 2021-09-06 20:47:38
 
 
→ Source
// Not my code! Taken from https://codeforces.com/contest/1567/submission/127985840
// and modified to use function attributes instead of pragmas.

#include <bits/stdc++.h>
using namespace std;

//#pragma GCC optimize("O3")
//#pragma GCC target("avx,avx2,sse,sse2,sse3,sse4,popcnt,fma")
//#pragma GCC optimize("unroll-loops")

#define fast_function \
  __attribute__((__optimize__("O3,unroll-loops"))) \
  __attribute__((__target__("avx,avx2,sse,sse2,sse3,sse4,popcnt,fma")))

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;


const ll mod = 1e9 + 7;
const ll INF = 1e18;
const int MAX = 1e5 + 1;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define endl "\n"
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

vector<int> soe;
void SieveOfEratosthenes(int n)
{
	bool prime[n + 1];
	memset(prime, true, sizeof(prime));
	for (int p = 2; p * p <= n; p++) {
		if (prime[p]) {
			for (int i = p * p; i <= n; i += p) prime[i] = false;
		}
	}
	for (int p = 2; p <= n; p++)
		if (prime[p])
			soe.push_back(p);
}
long long bin_exp(long long a, long long b, long long m) {
	a %= m;
	long long res = 1;
	while (b > 0) {
		if (b & 1)
			res = res * a % m;
		a = a * a % m;
		b >>= 1;
	}
	return res;
}
// int adj[100][100];
// bool visited[10001];

// void dfstraversal(int n, int index) {
// 	visited[index] = true;
// 	cout << index << " ";
// 	for (int i = 0; i < n; i++) {
// 		if (!visited[i]) {
// 			dfstraversal(n, i);
// 		}
// 	}
// }


// void bfs(int n) {
// 	queue<int> q;
// 	q.push(0);
// 	visited[0] = true;
// 	while (!q.empty()) {
// 		int cur = q.front();
// 		cout << q.front() << " ";
// 		q.pop();
// 		for (int i = 0; i < n; i++) {
// 			if (adj[cur][i] == 1 && !visited[i]) {
// 				q.push(i);
// 				visited[i] = true;
// 			}
// 		}
// 	}
// }
void fast_function solve() {
	int n, y;
	cin >> n >> y;
	int p = 0;
	for (int i = 0; i < n; i++) p ^= i;
	int z = p ^ y;
	if (p == y) {cout << n << endl; return;}
	else if (z != n) {cout << n + 1 << endl; return;}
	else {cout << n + 2 << endl; return;}
	return;
}
int main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	cerr << "Executed in:" << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt", "w", stderr);
#endif
	//2077000 max values at which we can find sieve and value will be 154233
	// SieveOfEratosthenes(1000000);
	int t;
	cin >> t;
	// t = 1;
	while (t--)
		solve();

	return 0;
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details