結果

問題 No.110 しましまピラミッド
ユーザー hiyokko2hiyokko2
提出日時 2016-07-30 11:22:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 793 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 10,840 KB
実行使用メモリ 8,336 KB
最終ジャッジ日時 2023-08-30 03:55:46
合計ジャッジ時間 1,894 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,156 KB
testcase_01 AC 17 ms
8,292 KB
testcase_02 AC 18 ms
8,232 KB
testcase_03 AC 18 ms
8,212 KB
testcase_04 AC 17 ms
8,168 KB
testcase_05 AC 16 ms
7,988 KB
testcase_06 AC 17 ms
8,272 KB
testcase_07 AC 16 ms
8,336 KB
testcase_08 AC 17 ms
8,212 KB
testcase_09 AC 16 ms
8,188 KB
testcase_10 AC 16 ms
8,328 KB
testcase_11 AC 16 ms
8,144 KB
testcase_12 AC 16 ms
8,232 KB
testcase_13 AC 17 ms
8,288 KB
testcase_14 AC 17 ms
8,180 KB
testcase_15 AC 16 ms
8,004 KB
testcase_16 AC 16 ms
8,144 KB
testcase_17 AC 17 ms
8,176 KB
testcase_18 AC 17 ms
8,176 KB
testcase_19 AC 17 ms
8,288 KB
testcase_20 AC 16 ms
8,212 KB
testcase_21 AC 16 ms
8,176 KB
testcase_22 AC 17 ms
8,000 KB
testcase_23 AC 16 ms
8,180 KB
testcase_24 AC 16 ms
8,208 KB
testcase_25 AC 16 ms
8,216 KB
testcase_26 AC 16 ms
8,292 KB
testcase_27 AC 16 ms
8,224 KB
testcase_28 AC 16 ms
8,332 KB
testcase_29 AC 16 ms
8,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

def get_smaller_largest(l, n):
	for i in range(len(l) - 1, -1, -1):
		if l[i] < n:
			return l[i]
	return None

def calc_height(pWl, pBl, pColor):
	now_color = pColor
	now_len = 999
	now_height = 0
	while True:
		if now_color == 0:
			#次に白ブロックを積む
			smaller = get_smaller_largest(pWl, now_len)
			if smaller is None:
				break
		elif now_color == 1:
			#次に黒ブロックを積む
			smaller = get_smaller_largest(pBl, now_len)
			if smaller is None:
				break
		now_color = (now_color + 1) % 2
		now_len = smaller
		now_height += 1
	return now_height



Nw = int(input())
Wl = sorted(map(int, input().split()))
Nb = int(input())
Bl = sorted(map(int, input().split()))
Wl2 = Wl[:]
Bl2 = Bl[:]

print(max(calc_height(Wl, Bl, 0), calc_height(Wl2, Bl2, 1)))
0