結果

問題 No.459 C-VS for yukicoder
ユーザー compass19compass19
提出日時 2016-12-10 01:18:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,446 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 23,600 KB
最終ジャッジ日時 2023-08-19 06:48:25
合計ジャッジ時間 7,962 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,908 KB
testcase_01 AC 16 ms
7,964 KB
testcase_02 AC 16 ms
7,872 KB
testcase_03 AC 16 ms
7,764 KB
testcase_04 AC 16 ms
7,764 KB
testcase_05 AC 16 ms
7,912 KB
testcase_06 AC 16 ms
7,868 KB
testcase_07 AC 16 ms
7,820 KB
testcase_08 AC 16 ms
7,868 KB
testcase_09 AC 16 ms
7,824 KB
testcase_10 AC 15 ms
7,872 KB
testcase_11 AC 16 ms
7,868 KB
testcase_12 AC 16 ms
7,952 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 22 ms
8,468 KB
testcase_16 AC 21 ms
8,236 KB
testcase_17 AC 18 ms
8,184 KB
testcase_18 AC 16 ms
8,308 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 270 ms
23,600 KB
testcase_22 AC 250 ms
21,844 KB
testcase_23 AC 245 ms
21,160 KB
testcase_24 AC 106 ms
13,548 KB
testcase_25 AC 74 ms
10,876 KB
testcase_26 AC 80 ms
9,700 KB
testcase_27 AC 61 ms
10,092 KB
testcase_28 AC 57 ms
10,952 KB
testcase_29 AC 108 ms
12,600 KB
testcase_30 AC 66 ms
9,784 KB
testcase_31 AC 67 ms
10,904 KB
testcase_32 AC 24 ms
8,708 KB
testcase_33 WA -
testcase_34 AC 88 ms
12,004 KB
testcase_35 AC 27 ms
8,864 KB
testcase_36 AC 81 ms
11,408 KB
testcase_37 AC 25 ms
8,552 KB
testcase_38 WA -
testcase_39 AC 25 ms
8,572 KB
testcase_40 WA -
testcase_41 AC 23 ms
8,444 KB
testcase_42 AC 59 ms
10,340 KB
testcase_43 AC 80 ms
11,460 KB
testcase_44 WA -
testcase_45 AC 30 ms
8,976 KB
testcase_46 AC 29 ms
8,852 KB
testcase_47 AC 25 ms
8,468 KB
testcase_48 AC 83 ms
11,500 KB
testcase_49 AC 26 ms
8,492 KB
testcase_50 WA -
testcase_51 AC 26 ms
8,732 KB
testcase_52 WA -
testcase_53 AC 28 ms
8,836 KB
testcase_54 WA -
testcase_55 AC 41 ms
9,228 KB
testcase_56 AC 62 ms
10,440 KB
testcase_57 AC 25 ms
8,964 KB
testcase_58 AC 89 ms
11,796 KB
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

# データ入力
h, w, n = map(int, input().split())
s = [0 for _ in range(w)]
for i in range(h):
	for k, elm in enumerate(list(input())): 
		if elm == '#': 
			s[k] += 1

c_tmp = [int(input()) for _ in range(n)]


# パック情報
# pack_dic[pack]: dict.
pack_dic = { pack: {'left': c_tmp[pack], 'elm': [0, 0, 0], 'sum': 0} for pack in range(n)}


# 列の情報の入力
# column_list[column] = list(columnに影響するpack_number)
column_list = [list() for _ in range(w)]
for pack, left in enumerate(c_tmp):
	column_list[left].append(pack)
	column_list[left+1].append(pack)
	column_list[left+2].append(pack)


# main(詰め込み)
for column in range(w):
	sorted_temp_list = sorted(column_list[column], \
							  key=lambda x: pack_dic[x]['sum'])

	# 列columnについて、そのcolumnに影響するpackを
	# 現時点でのpackの要素の合計が少ない順に#を詰める(要素が全くないpackをなくすため)
	stock = s[column]
	while stock != 0:
		for pack in sorted_temp_list:
			left = pack_dic[pack]['left']
			pack_dic[pack]['elm'][column-left] += 1
			pack_dic[pack]['sum'] += 1
			stock -= 1
			if stock == 0:
				break

def pack_print(_list):
	left, center, right = _list
	for _ in range(3):
		s = str()
		s += '#' if left > 0 else '.'
		s += '#' if center > 0 else '.'
		s += '#' if right > 0 else '.'
		print(s)
		left -= 1
		center -= 1
		right -= 1


for pack in range(n):
	pack_print(pack_dic[pack]['elm'])
0