-
Notifications
You must be signed in to change notification settings - Fork 9
/
SimpleXOR.cpp
67 lines (64 loc) · 1.39 KB
/
SimpleXOR.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <bits/stdc++.h>
using namespace std;
class solution
{
public:
void sol()
{
int l, r;
cin >> l >> r;
set<int> st;
bool ft = false;
for (int i = l; i <= r; i++)
{
for (int j = i + 1; j <= r; j++)
{
for (int k = j + 1; k <= r; k++)
{
int temp = (i ^ j ^ k);
if (temp >= lt and temp <= rt)
{
st.insert(i);
st.insert(j);
st.insert(k);
st.insert(temp);
if (st.size() == 4)
{
ft = true;
break;
}
}
}
if (ft)
{
break;
}
}
if (ft)
{
break;
}
}
if (st.size() == 0)
{
cout << -1 << endl;
return;
}
for (auto itr : st)
{
cout << itr << " ";
}
cout << endl;
}
};
int main()
{
int test;
cin >> test;
solution obj;
while (test--)
{
obj.sol();
}
return 0;
}