結果
問題 |
No.110 しましまピラミッド
|
ユーザー |
|
提出日時 | 2021-06-02 21:23:14 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 47 ms / 5,000 ms |
コード長 | 1,021 bytes |
コンパイル時間 | 243 ms |
コンパイル使用メモリ | 81,648 KB |
実行使用メモリ | 53,632 KB |
最終ジャッジ日時 | 2024-11-15 16:59:32 |
合計ジャッジ時間 | 2,646 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
import copy Na = int(input()) lsW1 = list(map(int,input().split())) lsW1.sort() lsW = copy.copy(lsW1) Nb = int(input()) lsB1 = list(map(int,input().split())) lsB1.sort() lsB = copy.copy(lsB1) cnt1 = 1 now = lsW.pop() while True: if cnt1 % 2 == 1: if not lsB: break if now > lsB[-1]: cnt1 += 1 now = lsB.pop() else: lsB.pop() if cnt1 % 2 == 0: if not lsW: break if now > lsW[-1]: cnt1 += 1 now = lsW.pop() else: lsW.pop() lsW = copy.copy(lsW1) lsB = copy.copy(lsB1) cnt2 = 1 now = lsB.pop() while True: if cnt2 % 2 == 1: if not lsW: break if now > lsW[-1]: cnt2 += 1 now = lsW.pop() else: lsW.pop() if cnt2 % 2 == 0: if not lsB: break if now > lsB[-1]: cnt2 += 1 now = lsB.pop() else: lsB.pop() print(max(cnt1,cnt2))