QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#334178#2956. Statuesmfshi03WA 8ms9796kbPython31.8kb2024-02-21 12:36:342024-02-21 12:36:34

Judging History

你现在查看的是最新测评结果

  • [2024-02-21 12:36:34]
  • 评测
  • 测评结果:WA
  • 用时:8ms
  • 内存:9796kb
  • [2024-02-21 12:36:34]
  • 提交

answer

m, n = tuple(map(int, input().split()))

matrix = []

for i in range(m):
    matrix.append(list(map(int, input().split())))

diag1 = []
diag2 = []

start1 = [(i, 0) for i in range(0, m)]
start1.extend([(m - 1, j) for j in range(1, n)])

start2 = [(i, n - 1) for i in range(0, m)]
start2.extend([(m - 1, n - 1 - j) for j in range(1, n)])

print(start1)
print(start2)
alln = []
for t in start1:
    i, j = t[0], t[1] 
    temp = []
    while i >= 0 and j < n:
        if matrix[i][j] != -1:
            alln.append(matrix[i][j])
            temp.append(matrix[i][j])
        i -= 1 
        j += 1

    diag1.append(temp)

for t in start2:
    i, j = t[0], t[1] 
    temp = []
    while j >= 0 and i >= 0:
        if matrix[i][j] != -1:
            temp.append(matrix[i][j])
        i -= 1 
        j -= 1

    diag2.append(temp)

print(diag1)
print(diag2)

c1 = sorted(alln)
c2 = sorted(alln)

d1_asc = 0
d1_desc = 0

d2_asc = 0
d2_desc = 0

for d in diag1:
    s = len(d)
    desc = c2[-s:]
    asc = c1[:s]
    print(desc, asc)
    move1 = s
    move2 = s
    for v in d:
        if v in asc:
            move1 -= 1 
        if v in desc:
            move2 -= 1 

    d1_asc += move1
    d1_desc += move2 

    c2 = c2[:-s]
    c1 = c1[s:]

c1 = sorted(alln)
c2 = sorted(alln)

for d in diag2:
    s = len(d)
    desc = c2[-s:]
    asc = c1[:s]
    print(desc, asc)
    move1 = s
    move2 = s
    for v in d:
        if v in asc:
            move1 -= 1 
        if v in desc:
            move2 -= 1 

    d2_asc += move1
    d2_desc += move2

    c2 = c2[:-s]
    c1 = c1[s:] 

print(d1_asc, d1_desc, d2_asc, d2_desc)
print(min(d1_asc, d1_desc, d2_asc, d2_desc))




    








    







    

詳細信息

Test #1:

score: 0
Wrong Answer
time: 8ms
memory: 9796kb

input:

50 50
9946 213 7427 7298 9772 2466 4890 2062 2490 1538 5605 4546 5426 2974 7693 5133 206 1329 7853 5669 8991 8828 1006 808 2227 1878 8900 8948 2755 8784 2564 5954 348 1718 2880 5820 7112 8161 4337 7247 5447 7465 1280 7708 1567 6280 129 9961 5758 9546
6412 3445 7559 7648 3160 3649 2388 7527 1800 4392...

output:

[(0, 0), (1, 0), (2, 0), (3, 0), (4, 0), (5, 0), (6, 0), (7, 0), (8, 0), (9, 0), (10, 0), (11, 0), (12, 0), (13, 0), (14, 0), (15, 0), (16, 0), (17, 0), (18, 0), (19, 0), (20, 0), (21, 0), (22, 0), (23, 0), (24, 0), (25, 0), (26, 0), (27, 0), (28, 0), (29, 0), (30, 0), (31, 0), (32, 0), (33, 0), (34...

result:

wrong answer 1st lines differ - expected: '2466', found: '[(0, 0), (1, 0), (2, 0), (3, 0..., (49, 47), (49, 48), (49, 49)]'