6341 | 2023-11-20 12:04:49 | Ghost | IntervallumXOR kihívás | cpp17 | Time limit exceeded 35/100 | 563ms | 2800 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
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1744 KiB | ||||
subtask2 | 15/15 | ||||||
2 | Accepted | 4ms | 1908 KiB | ||||
subtask3 | 0/15 | ||||||
3 | Time limit exceeded | 563ms | 1440 KiB | ||||
subtask4 | 20/20 | ||||||
4 | Accepted | 28ms | 2532 KiB | ||||
subtask5 | 0/50 | ||||||
5 | Time limit exceeded | 559ms | 2756 KiB | ||||
6 | Time limit exceeded | 560ms | 2800 KiB |