結果
| 問題 | No.110 しましまピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2014-12-23 23:31:59 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 5,000 ms |
| + 128µs | |
| コード長 | 870 bytes |
| 記録 | |
| コンパイル時間 | 71 ms |
| コンパイル使用メモリ | 81,280 KB |
| 実行使用メモリ | 81,280 KB |
| 最終ジャッジ日時 | 2026-07-17 08:48:30 |
| 合計ジャッジ時間 | 3,616 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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())