26842023-01-18 21:32:59kohumarkIntervallumXOR kihíváscpp11Time limit exceeded 15/100583ms3180 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1892 KiB
subtask215/15
2Accepted342ms2124 KiB
subtask30/15
3Time limit exceeded559ms2328 KiB
subtask40/20
4Time limit exceeded565ms2536 KiB
subtask50/50
5Time limit exceeded565ms2732 KiB
6Time limit exceeded583ms3180 KiB