QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#789773#9802. Light Up the GridhskWA 424ms10728kbPython31.1kb2024-11-27 21:48:272024-11-27 21:48:27

Judging History

你现在查看的是测评时间为 2024-11-27 21:48:27 的历史记录

  • [2024-11-29 22:57:31]
  • 管理员手动重测本题所有提交记录
  • 测评结果:WA
  • 用时:431ms
  • 内存:10720kb
  • [2024-11-27 21:48:27]
  • 评测
  • 测评结果:0
  • 用时:424ms
  • 内存:10728kb
  • [2024-11-27 21:48:27]
  • 提交

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=[[0]*(c1+1) for i in range(c1+1)]
    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[i][j]=c[c2[i]^c2[j]]
            c3[j][i]=c[c2[i]^c2[j]]
    a=0
    se=set([0])
    ans=0
    while len(se)!=c1+1:
        j=c3[a].index(max(c3[a]))
        for i in range(len(c3[a])):
            if i in se:
                continue
            if c3[a][j]>c3[a][i]:j=i
        ans+=c3[a][j]
        se.add(j)
        a=j
    print(ans)

詳細信息

Test #1:

score: 100
Accepted
time: 15ms
memory: 10644kb

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: 10ms
memory: 10616kb

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: 10728kb

input:

1 1000000 1000000 1000000 1000000
1
11
11

output:

2000000

result:

ok 1 number(s): "2000000"

Test #4:

score: -100
Wrong Answer
time: 424ms
memory: 10640kb

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:

34
32
36
36
40
38
42
38
40
42
36
44
34
37
48
34
29
39
40
40
38
50
46
38
31
47
37
38
34
35
32
42
34
38
42
40
46
34
39
36
29
38
40
40
45
39
39
38
38
40
42
29
43
42
36
42
46
40
41
34
42
40
37
33
34
40
38
37
42
40
36
38
29
34
34
38
36
39
38
38
36
38
35
36
36
34
42
42
38
38
40
40
40
42
38
29
36
40
38
36
...

result:

wrong answer 6th numbers differ - expected: '36', found: '38'