結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-07-03 22:37:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 5,000 ms |
| コード長 | 1,189 bytes |
| コンパイル時間 | 246 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 52,608 KB |
| 最終ジャッジ日時 | 2024-07-17 20:38:03 |
| 合計ジャッジ時間 | 2,603 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
nw = int(input())
W = list(map(int, input().split()))
nb = int(input())
B = list(map(int, input().split()))
W.sort(reverse=True)
B.sort(reverse=True)
Wc = W[:]
Bc = B[:]
res = 1
l = W[0]
iw, ib = 1, 0
white = False
while True:
if white:
while iw < nw:
ll = W[iw]
if ll < l:
break
iw += 1
if iw == nw:
break
l = ll
res += 1
white = False
else:
while ib < nb:
ll = B[ib]
if ll < l:
break
ib += 1
if ib == nb:
break
l = ll
res += 1
white = True
ans = res
res = 1
l = B[0]
iw, ib = 0, 1
white = True
while True:
if white:
while iw < nw:
ll = W[iw]
if ll < l:
break
iw += 1
if iw == nw:
break
l = ll
res += 1
white = False
else:
while ib < nb:
ll = B[ib]
if ll < l:
break
ib += 1
if ib == nb:
break
l = ll
res += 1
white = True
ans = max(ans, res)
print(ans)