2554 | 2023-01-17 01:50:18 | kristof | IntervallumXOR kihívás | python3 | Time limit exceeded 35/100 | 601ms | 12940 KiB |
#spagetti
from sys import stdin, stdout
import sys
pow2 = [1 << i for i in range(30)][::-1]
#x = [0 for i in range(200000)]
N = int(input())
x = [int(stdin.readline()) for i in range(N)]
for i in range(N):
# x = int(input())
if x[i] % 4 == 0:
xor = x[i]
if x[i] % 4 == 1:
xor = 1
if x[i] % 4 == 2:
xor = x[i] + 1
if x[i] % 4 == 3:
xor = 0
drop = xor
for index in range(30):
if pow2[index] ^ drop <= x[i]:
drop ^= pow2[index]
#print(xor, xor ^ drop)
sys.stdout.write(str(xor) + " " + str(xor ^ drop) + "\n")
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 18ms | 11196 KiB | ||||
subtask2 | 15/15 | ||||||
2 | Accepted | 27ms | 11980 KiB | ||||
subtask3 | 0/15 | ||||||
3 | Time limit exceeded | 552ms | 12220 KiB | ||||
subtask4 | 20/20 | ||||||
4 | Accepted | 18ms | 12044 KiB | ||||
subtask5 | 0/50 | ||||||
5 | Time limit exceeded | 601ms | 12636 KiB | ||||
6 | Time limit exceeded | 555ms | 12940 KiB |