Submission #2713885


Source Code Expand

def read():
    return int(input())


def readlist():
    return list(map(int, input().split()))


def readmap():
    return map(int, input().split())


H, W = readmap()
N = read()
A = readlist()

C = [[0] * W for _ in range(H)]

i = 0
j = 0
for n in range(N):
    a = A[n]
    while a:
        C[i][j] = n + 1
        if (j == 0 and i % 2 == 1) or (j == W - 1 and i % 2 == 0):
            i += 1
        elif i % 2 == 0:
            j += 1
        else:
            j -= 1
        a -= 1

for i in range(H):
    print(" ".join(list(map(str, C[i]))))

Submission Info

Submission Time
Task D - Grid Coloring
User coro65536
Language Python (3.4.3)
Score 400
Code Size 583 Byte
Status AC
Exec Time 27 ms
Memory 3568 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 25
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt
Case Name Status Exec Time Memory
0_00.txt AC 17 ms 3064 KB
0_01.txt AC 17 ms 3064 KB
0_02.txt AC 17 ms 3064 KB
1_00.txt AC 17 ms 3064 KB
1_01.txt AC 17 ms 3064 KB
1_02.txt AC 17 ms 3064 KB
1_03.txt AC 24 ms 3064 KB
1_04.txt AC 25 ms 3440 KB
1_05.txt AC 26 ms 3568 KB
1_06.txt AC 22 ms 3064 KB
1_07.txt AC 17 ms 3064 KB
1_08.txt AC 17 ms 3064 KB
1_09.txt AC 18 ms 3064 KB
1_10.txt AC 17 ms 3064 KB
1_11.txt AC 17 ms 3064 KB
1_12.txt AC 17 ms 3064 KB
1_13.txt AC 27 ms 3440 KB
1_14.txt AC 17 ms 3064 KB
1_15.txt AC 18 ms 3064 KB
1_16.txt AC 17 ms 3064 KB
1_17.txt AC 22 ms 3064 KB
1_18.txt AC 18 ms 3064 KB
1_19.txt AC 18 ms 3064 KB
1_20.txt AC 17 ms 3064 KB
1_21.txt AC 17 ms 3064 KB