2550 | 2023-01-17 00:09:33 | kristof | IntervallumXOR kihívás | python3 | Time limit exceeded 35/100 | 560ms | 11932 KiB |
#spagetti
pow2 = [1 << i for i in range(30)][::-1]
N = int(input())
i = 0
while i < N:
i += 1
x = int(input())
if x % 4 == 0:
xor = x
if x % 4 == 1:
xor = 1
if x % 4 == 2:
xor = x + 1
if x % 4 == 3:
xor = 0
drop = xor
for index in range(30):
if pow2[index] ^ drop <= x:
# print(index, pow2[index])
drop ^= pow2[index]
print(xor, xor ^ drop)
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 17ms | 11472 KiB | ||||
subtask2 | 15/15 | ||||||
2 | Accepted | 29ms | 11852 KiB | ||||
subtask3 | 0/15 | ||||||
3 | Time limit exceeded | 560ms | 4252 KiB | ||||
subtask4 | 20/20 | ||||||
4 | Accepted | 17ms | 11932 KiB | ||||
subtask5 | 0/50 | ||||||
5 | Time limit exceeded | 559ms | 4796 KiB | ||||
6 | Time limit exceeded | 556ms | 4968 KiB |