63412023-11-20 12:04:49GhostIntervallumXOR kihíváscpp17Time limit exceeded 35/100563ms2800 KiB
#include <iostream>

using namespace std;

int main()
{
    int q, a, i;
    cin >> q;

    for (i = 0; i < q; i++) {
        cin >> a;
        int out = 0, max = 0;
        for (int j = a - (a % 4); j <= a; j++) {
            out ^= j;
        }
        for (int j = 0; j <= a; j++)
        {
            if ((out ^ j) > max) {
                max = out ^ j;
            }
        }
        cout << out << ' ' << max << "\n";
    }
}
//0001 1
//0011 2
//0000 3
//0100 4
//0001 5 
//0111 6
//0000 7
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1744 KiB
subtask215/15
2Accepted4ms1908 KiB
subtask30/15
3Time limit exceeded563ms1440 KiB
subtask420/20
4Accepted28ms2532 KiB
subtask50/50
5Time limit exceeded559ms2756 KiB
6Time limit exceeded560ms2800 KiB