結果
問題 | No.910 素数部分列 |
ユーザー | Coki628 |
提出日時 | 2020-08-07 16:58:52 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,234 bytes |
コンパイル時間 | 261 ms |
コンパイル使用メモリ | 82,728 KB |
実行使用メモリ | 91,792 KB |
最終ジャッジ日時 | 2024-09-24 10:52:08 |
合計ジャッジ時間 | 5,263 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 42 ms
54,848 KB |
testcase_01 | AC | 41 ms
55,496 KB |
testcase_02 | AC | 41 ms
55,056 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 41 ms
55,680 KB |
testcase_06 | AC | 41 ms
54,768 KB |
testcase_07 | AC | 41 ms
54,872 KB |
testcase_08 | AC | 43 ms
55,708 KB |
testcase_09 | AC | 41 ms
55,016 KB |
testcase_10 | AC | 41 ms
55,120 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 41 ms
54,328 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 42 ms
54,512 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | AC | 78 ms
78,248 KB |
testcase_44 | AC | 75 ms
78,240 KB |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | AC | 68 ms
77,824 KB |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | AC | 72 ms
77,816 KB |
testcase_52 | AC | 75 ms
84,768 KB |
ソースコード
import sys from collections import Counter def input(): return sys.stdin.readline().strip() def list2d(a, b, c): return [[c] * b for i in range(a)] def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)] def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)] def ceil(x, y=1): return int(-(-x // y)) def INT(): return int(input()) def MAP(): return map(int, input().split()) def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)] def Yes(): print('Yes') def No(): print('No') def YES(): print('YES') def NO(): print('NO') sys.setrecursionlimit(10 ** 9) INF = 10 ** 19 MOD = 10 ** 9 + 7 EPS = 10 ** -10 N = INT() S = input() C = Counter(S) ans = C['3'] + C['5'] + C['7'] # 19 cnt1 = [] used = [0] * N for i in range(N): if S[i] == '1': cnt1.append(i) elif S[i] == '9' and cnt1: j = cnt1.pop() ans += 1 used[i] = 1 used[j] = 1 # 911 cnt9 = cnt91 = 0 for i in range(N): if used[i]: continue if S[i] == '9': cnt9 += 1 elif S[i] == '1' and cnt91: cnt91 -= 1 ans += 1 elif S[i] == '1' and cnt9: cnt9 -= 1 cnt91 += 1 print(ans)