2684 | 2023-01-18 21:32:59 | kohumark | IntervallumXOR kihívás | cpp11 | Time limit exceeded 15/100 | 583ms | 3180 KiB |
#include <iostream>
using namespace std;
int main()
{
cin.tie(0); ios_base::sync_with_stdio(false);
int q, a;
cin >> q;
for (int i = 0; i < q; i++)
{
cin >> a;
int xor_val = 0;
for (int j = 0; j <= a; j++)
{
xor_val ^= j;
}
int max_xor_omit = 0;
for (int j = 0; j <= a; j++)
{
int temp_xor = 0;
for (int k = 0; k <= a; k++)
{
if (k != j)
temp_xor ^= k;
}
max_xor_omit = max(max_xor_omit, temp_xor);
}
cout << xor_val << " " << max_xor_omit << endl;
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1892 KiB | ||||
subtask2 | 15/15 | ||||||
2 | Accepted | 342ms | 2124 KiB | ||||
subtask3 | 0/15 | ||||||
3 | Time limit exceeded | 559ms | 2328 KiB | ||||
subtask4 | 0/20 | ||||||
4 | Time limit exceeded | 565ms | 2536 KiB | ||||
subtask5 | 0/50 | ||||||
5 | Time limit exceeded | 565ms | 2732 KiB | ||||
6 | Time limit exceeded | 583ms | 3180 KiB |