結果
| 問題 | No.910 素数部分列 |
| コンテスト | |
| ユーザー |
convexineq
|
| 提出日時 | 2021-04-11 16:53:19 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 43 ms / 1,000 ms |
| + 257µs | |
| コード長 | 352 bytes |
| 記録 | |
| コンパイル時間 | 83 ms |
| コンパイル使用メモリ | 64,216 KB |
| 実行使用メモリ | 58,716 KB |
| 最終ジャッジ日時 | 2026-11-15 17:37:55 |
| 合計ジャッジ時間 | 4,758 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 52 |
ソースコード
n = int(input())
s = input()
for i in "357":
s = s.replace(i,"")
ans = n - len(s)
#11,19,991
one = nine = 0
for i,si in enumerate(s):
if si == "1":
one += 1
else:
if one:
ans += 1
one -= 1
else:
nine += 1
c = min(one,nine//2)
ans += c
one -= c
nine -= 2*c
ans += one//2
print(ans)
convexineq