結果
問題 |
No.110 しましまピラミッド
|
ユーザー |
![]() |
提出日時 | 2016-07-30 11:22:54 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 32 ms / 5,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 402 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-12-31 11:22:40 |
合計ジャッジ時間 | 2,133 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
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)))