6340 | 2023-11-20 11:55:55 | Ghost | IntervallumXOR kihívás | cpp17 | Time limit exceeded 35/100 | 565ms | 2948 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 = 0; 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 | 1880 KiB | ||||
subtask2 | 15/15 | ||||||
2 | Accepted | 4ms | 2120 KiB | ||||
subtask3 | 0/15 | ||||||
3 | Time limit exceeded | 559ms | 1932 KiB | ||||
subtask4 | 20/20 | ||||||
4 | Accepted | 52ms | 2920 KiB | ||||
subtask5 | 0/50 | ||||||
5 | Time limit exceeded | 565ms | 2948 KiB | ||||
6 | Time limit exceeded | 540ms | 2444 KiB |