結果
| 問題 | No.110 しましまピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-02 21:23:14 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 28 ms / 5,000 ms |
| + 678µs | |
| コード長 | 1,021 bytes |
| 記録 | |
| コンパイル時間 | 698 ms |
| コンパイル使用メモリ | 82,472 KB |
| 実行使用メモリ | 57,848 KB |
| 最終ジャッジ日時 | 2026-09-23 09:34:30 |
| 合計ジャッジ時間 | 3,216 ms |
|
ジャッジサーバーID (参考情報) |
judge4_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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))