QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#789610 | #9802. Light Up the Grid | hsk | WA | 344ms | 10644kb | Python3 | 1.1kb | 2024-11-27 21:08:14 | 2024-11-29 22:57:25 |
Judging History
answer
n,a1,a2,a3,a4=map(int,input().split())
c={
0:2*min(a1,a2,a3,a4),
1:a1,
2:a1,
3:min(a1*2,a2),
4:a1,
5:min(a1*2,a3),
6:min(a1*2,a2+a3),
7:a1+min(a2,a3,a4,2*a1),
8:a1,
9:min(a1*2,a2+a3),
10:min(a1*2,a3),
11:a1+min(a2,a3,a4,2*a1),
12:min(a1*2,a2),
13:a1+min(a2,a3,a4,2*a1),
14:a1+min(a2,a3,a4,2*a1),
15:min(a4,2*min(a2,a3,2*a1))
}
for _ in range(n):
c1=int(input())
c2=[0]#存点
c3=[]
c4=[2]*(c1+1)
for i in range(c1):
a=int(input(),2)
a+=int(input(),2)*4
a^=15
c2.append(a)
if i!=c1-1:
input()
for i in range(c1+1):
for j in range(i+1,c1+1):
c3.append((i,j,c[c2[i]^c2[j]]))
c3.sort(key= lambda x:x[-1])
t=0
i=0
ans=0
while t<c1:
sk=c3[i]
if c4[sk[0]] and c4[sk[1]] and (t!=c1-1 or (t==c1-1 and (2 in [c4[sk[0]] , c4[sk[1]]] or c4.count(1)==4))):
c4[sk[0]]-=1
c4[sk[1]]-=1
ans+=sk[2]
t+=1
i+=1
print(ans)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 16ms
memory: 10636kb
input:
2 1000 100 10 1 4 10 00 01 00 00 10 00 01 1 11 11
output:
1121 2
result:
ok 2 number(s): "1121 2"
Test #2:
score: 0
Accepted
time: 8ms
memory: 10644kb
input:
2 1 1 1 1 4 10 00 01 00 00 10 00 01 1 11 11
output:
5 2
result:
ok 2 number(s): "5 2"
Test #3:
score: 0
Accepted
time: 12ms
memory: 10640kb
input:
1 1000000 1000000 1000000 1000000 1 11 11
output:
2000000
result:
ok 1 number(s): "2000000"
Test #4:
score: -100
Wrong Answer
time: 344ms
memory: 10616kb
input:
10000 8 2 7 8 8 00 01 00 11 00 10 11 11 10 10 01 10 01 00 10 11 8 11 01 11 00 01 10 11 11 00 01 01 01 01 00 11 10 9 00 00 01 01 10 11 00 01 11 10 11 00 11 11 00 11 01 10 9 11 11 10 00 11 00 11 01 00 10 01 11 00 01 01 01 10 01 11 00 01 01 01 10 10 00 11 11 11 11 10 ...
output:
31 26 35 30 29 27 34 30 29 34 35 34 31 28 28 26 20 36 29 29 27 35 36 29 26 35 33 28 26 29 24 30 28 28 34 31 32 27 28 25 18 26 31 32 28 25 34 26 30 35 33 20 28 34 30 34 28 37 30 31 37 32 38 24 28 35 33 35 28 30 25 27 18 28 28 28 33 28 38 28 32 26 29 31 28 30 37 28 31 28 32 34 33 32 33 25 28 30 30 26 ...
result:
wrong answer 1st numbers differ - expected: '34', found: '31'