Submission #8540331
Source Code Expand
# 2019-11-20 23:47:42(JST) import sys # import collections # import math # from string import ascii_lowercase, ascii_uppercase, digits # from bisect import bisect_left as bi_l, bisect_right as bi_r # import itertools # from functools import reduce # import operator as op # import re # import heapq # import array # from scipy.misc import comb # (default: exact=False) # import numpy as np def main(): H, W, n, *a = [int(x) for x in sys.stdin.read().split()] color_count = [None] + a canvas = [[None for _ in range(W)] for _ in range(H)] h, w = 0, 0 for i in range(1, n+1): while color_count[i] > 0: canvas[h][w] = i color_count[i] -= 1 if h % 2 == 0: w += 1 if w == W: h += 1 w = W - 1 else: w -= 1 if w == -1: h += 1 w = 0 for h in range(H): print(' '.join(map(str, canvas[h]))) if __name__ == "__main__": main()
Submission Info
Submission Time | |
---|---|
Task | D - Grid Coloring |
User | Kagemeka |
Language | Python (3.4.3) |
Score | 400 |
Code Size | 1112 Byte |
Status | AC |
Exec Time | 25 ms |
Memory | 3696 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
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 | 22 ms | 3188 KB |
1_04.txt | AC | 24 ms | 3316 KB |
1_05.txt | AC | 25 ms | 3568 KB |
1_06.txt | AC | 21 ms | 3188 KB |
1_07.txt | AC | 17 ms | 3064 KB |
1_08.txt | AC | 17 ms | 3064 KB |
1_09.txt | AC | 17 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 | 24 ms | 3696 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 | 21 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 |