結果
| 問題 | No.110 しましまピラミッド |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-18 15:57:28 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 103 ms / 5,000 ms |
| + 517µs | |
| コード長 | 711 bytes |
| 記録 | |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 64,384 KB |
| 実行使用メモリ | 58,624 KB |
| 最終ジャッジ日時 | 2026-10-18 15:57:32 |
| 合計ジャッジ時間 | 3,956 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
from itertools import product
Nw = int(input())
W = list(map(int, input().split()))
Nb = int(input())
B = list(map(int, input().split()))
data = []
for w in W:
data.append((w, 0))
for b in B:
data.append((b, 1))
data.sort()
N = Nw + Nb
ans = 0
for pat in product([0, 1], repeat=N):
# 前と=じゃないかだけ
pre_color = -1
pre_length = 0
cnt = 0
for i in range(N):
if pat[i] == 1:
cnt += 1
length, color = data[i]
if pre_color == color:
break
if pre_length == length:
break
pre_color = color
pre_length = length
else:
ans = max(ans, cnt)
print(ans)