QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#565662 | #8470. Deep Abyss | MIT Isn’t Training (Jiangqi Dai, Ziqian Zhong, Peter Zhou)# | RE | 0ms | 0kb | Python3 | 3.3kb | 2024-09-15 21:58:42 | 2024-09-15 21:58:46 |
Judging History
answer
import copy
L = 128
class S:
u: list[list[int]]
def __init__(self, num = None):
self.u = []
if num is not None:
self.u = [None] * L
for w in range(L):
if num&(1<<w):
self.u[w] = [0] * L + [1]
else:
self.u[w] = [0] * (L+1)
def __and__(self, num):
p = copy.deepcopy(self)
for w in range(L):
if num&(1<<w):
pass
else:
p.u[w] = [0] * (L+1)
return p
def __rand__(self, num):
return self.__and__(num)
def __or__(self, num):
p = copy.deepcopy(self)
for w in range(L):
if num&(1<<w):
p.u[w] = [0] * L + [1]
return p
def __ror__(self, num):
return self.__or__(num)
def __xor__(self, num):
p = copy.deepcopy(self)
if type(num) != S:
num = S(num)
for w in range(L):
p.u[w] = [x^y for x,y in zip(p.u[w],num.u[w])]
return p
def __rxor__(self, num):
return self.__xor__(num)
def __lshift__(self, x):
p = S(0)
for w in range(L):
if w+x<L: p.u[w+x]=self.u[w]
return p
def __rshift__(self, x):
p = S(0)
for w in range(L):
if w-x>=0: p.u[w-x]=self.u[w]
return p
def __invert__(self):
p = copy.deepcopy(self)
for w in range(L):
p.u[w][L] ^= 1
return p
def X():
u = S()
for w in range(L):
u.u.append([1 if s==w else 0 for s in range(L+1)])
return u
x__ = X()
x0 = copy.deepcopy(x__)
def FIXX(W):
if type(W)!=S:
W = S(W)
return W
while True:
try:
U = input()
U = U.strip()
assert U!=''
except:
break
U = ''.join(S+'__' if 'a'<=S<='z' else S for S in U)
UP = ''.join([S if 'a'<=S<='z' or S=='_' else ' ' for S in U])
UP = [S.strip() for S in UP.split(' ') if S.strip()!='']
while True:
try:
exec(U)
except NameError as e:
try:
exec(f'{e.name} = 0')
except:
pass
continue
break
LL = UP[0]
exec(f'{LL} = FIXX({LL})')
try:
x = x0^x__ # make sure it's zero!
xx = copy.deepcopy(x)
S = 0
R = [0] * 128 + [1]
for i in range(L):
J = -1
for j in range(S,L):
if x.u[j][i]:
J=j
break
if J == -1:
continue
if J != S:
x.u[J],x.u[S] = x.u[S],x.u[J]
for u in range(0,L):
if u!=S and x.u[u][i]:
x.u[u] = [a^b for a,b in zip(x.u[u],x.u[S])]
S += 1
for i in range(L):
if not x.u[i][L]:
continue
out = -1
for j in range(L):
if x.u[i][j]:
out = j
break
R[out] = 1
#print(x.u)
bad = 0
for a in xx.u:
if sum(p*q for p,q in zip(a,R))%2:
bad = 1
if bad:
print(':(')
else:
ans = 0
for u in range(L):
if R[u]: ans|=1<<u
print('0x{:x}'.format(ans))
except:
while True:
pass
詳細信息
Test #1:
score: 0
Dangerous Syscalls
input:
x = x | 0x19260817