結果
| 問題 | No.110 しましまピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-26 14:47:20 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 98 ms / 5,000 ms |
| コード長 | 839 bytes |
| 記録 | |
| コンパイル時間 | 150 ms |
| コンパイル使用メモリ | 77,332 KB |
| 最終ジャッジ日時 | 2025-12-03 22:24:02 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
Nw = input()
Ww = sorted(list(set(map(int, raw_input().split()))))
Nb = input()
Bb = sorted(list(set(map(int, raw_input().split()))))
def solve(last):
ans = 0
W = Ww[:]
B = Bb[:]
while len(W) > 0 and len(B) > 0:
if W[-1] == B[-1]:
a = W.pop()
B.pop()
ans += 1
if last == 'B':
last = 'W'
elif last == 'W':
last = 'B'
elif W[-1] > B[-1]:
a = W.pop()
if last == 'B':
ans += 1
last = 'W'
else:
a = B.pop()
if last == 'W':
ans += 1
last = 'B'
if len(W) > 0 and last == 'B':
ans += 1
elif len(B) > 0 and last == 'W':
ans += 1
return ans
print max(solve('B'), solve('W'))