結果
| 問題 | No.110 しましまピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-12-23 23:31:59 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 96 ms / 5,000 ms |
| コード長 | 870 bytes |
| 記録 | |
| コンパイル時間 | 396 ms |
| コンパイル使用メモリ | 77,576 KB |
| 最終ジャッジ日時 | 2025-12-03 13:26:42 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#!/usr/bin/env python
def read():
input()
wList = map(int, raw_input().split())
input()
bList = map(int, raw_input().split())
return wList, bList
def work((wList, bList)):
lengColorList = [] # (leng, isWhite)
for leng in wList:
lengColorList.append((leng, True))
for leng in bList:
lengColorList.append((leng, False))
lengColorList.sort()
# dp[lastColor][lastLeng]: best height
dp = [[-1 for j in range(21)] for i in range(2)]
dp[0][0] = 0
dp[1][0] = 0
for (leng, isWhite) in lengColorList:
for lastLeng in range(leng):
if dp[not isWhite][lastLeng] == -1:
continue
dp[isWhite][leng] = max(dp[isWhite][leng], dp[not isWhite][lastLeng] + 1)
print max(max(dp[0]), max(dp[1]))
if __name__ == "__main__":
work(read())