結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-12-20 22:57:45 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 5,000 ms |
| コード長 | 597 bytes |
| コンパイル時間 | 1,843 ms |
| コンパイル使用メモリ | 76,728 KB |
| 実行使用メモリ | 76,072 KB |
| 最終ジャッジ日時 | 2024-12-31 11:13:34 |
| 合計ジャッジ時間 | 4,038 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
nw = input()
w = map(int, raw_input().split())
nb = input()
b = map(int, raw_input().split())
w.sort(reverse = True)
b.sort(reverse = True)
def solve(nw, w, nb, b):
i = 0
j = 0
res = 0
under = float('inf')
updated = True
k = 0
while updated:
updated = False
if k % 2 == 0:
while i < nw and w[i] >= under:
i += 1
if i < nw:
under = w[i]
res += 1
updated = True
else:
while j < nb and b[j] >= under:
j += 1
if j < nb:
under = b[j]
res += 1
updated = True
k += 1
return res
ans = max(solve(nw, w, nb, b), solve(nb, b, nw, w))
print ans