結果
| 問題 |
No.910 素数部分列
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-15 21:31:56 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 460 bytes |
| コンパイル時間 | 342 ms |
| コンパイル使用メモリ | 81,536 KB |
| 実行使用メモリ | 108,928 KB |
| 最終ジャッジ日時 | 2025-04-15 21:34:18 |
| 合計ジャッジ時間 | 4,738 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 WA * 28 |
ソースコード
n = int(input())
s = input().strip()
cnt1 = 0
remaining = []
for c in s:
if c in {'3', '5', '7'}:
cnt1 += 1
else:
remaining.append(c)
A = [i for i, c in enumerate(remaining) if c == '1']
B = [i for i, c in enumerate(remaining) if c == '9']
i = j = y = 0
while i < len(A) and j < len(B):
if A[i] < B[j]:
y += 1
i += 1
j += 1
else:
j += 1
x = (len(A) - y) // 2
cnt2 = y + x
print(cnt1 + cnt2)
lam6er