QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#419626 | #6563. Four Square | ohiostatescarlet | WA | 15ms | 10612kb | Python3 | 1.1kb | 2024-05-24 04:43:37 | 2024-05-24 04:43:38 |
Judging History
answer
from itertools import permutations
def test(a):
if a[0][1] + a[2][1] == a[1][1] + a[3][1] and a[0][0] == a[2][0] and a[1][0] == a[3][0] and a[0][1] + a[2][1] == a[0][0] + a[2][0]:
return True
if a[0][1] + a[1][1] + a[2][1] == a[3][1] and a[0][0] == a[1][0] == a[2][0] and a[3][1] == a[0][0] + a[3][0]:
return True
if a[0][0] == a[1][0] and a[0][1] + a[1][1] == a[2][1] == a[3][1] and a[0][0] + a[2][0] + a[3][0] == a[2][1]:
return True
if a[0][1] == a[1][1] == a[2][1] == a[3][1] and a[0][1] == a[0][0] + a[1][0] + a[2][0] + a[3][0]:
return True
if a[0][1] + a[1][1] == a[3][1] and a[1][1] == a[2][1] and a[0][0] == a[1][0] + a[2][0] and a[0][0] + a[3][0] == a[0][1] + a[1][1]:
return True
return False
a = [list(map(int, input().split())) for _ in range(4)]
for swap in range(2**4):
b = [i.copy() for i in a]
for i in range(4):
if swap & (1 << i):
b[i] = b[i][::-1]
for i in permutations(b):
# print(i)
if test(i):
print(1)
exit()
print(0)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 15ms
memory: 10608kb
input:
1 1 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 15ms
memory: 10604kb
input:
3 1 3 3 2 2 3 3
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 11ms
memory: 10572kb
input:
2 8 2 8 2 8 2 8
output:
1
result:
ok single line: '1'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 10612kb
input:
5 3 5 5 3 3 3 5
output:
0
result:
wrong answer 1st lines differ - expected: '1', found: '0'