結果
問題 | No.2772 Appearing Even Times |
ユーザー |
![]() |
提出日時 | 2024-05-31 21:59:02 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,405 ms / 4,000 ms |
コード長 | 855 bytes |
コンパイル時間 | 432 ms |
コンパイル使用メモリ | 82,428 KB |
実行使用メモリ | 157,040 KB |
最終ジャッジ日時 | 2024-12-20 23:22:42 |
合計ジャッジ時間 | 28,747 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 |
ソースコード
def popcount(n):c=(n&0x5555555555555555)+((n>>1)&0x5555555555555555)c=(c&0x3333333333333333)+((c>>2)&0x3333333333333333)c=(c&0x0f0f0f0f0f0f0f0f)+((c>>4)&0x0f0f0f0f0f0f0f0f)c=(c&0x00ff00ff00ff00ff)+((c>>8)&0x00ff00ff00ff00ff)c=(c&0x0000ffff0000ffff)+((c>>16)&0x0000ffff0000ffff)c=(c&0x00000000ffffffff)+((c>>32)&0x00000000ffffffff)return cmod = 998244353N = input()le = len(N)dp = [[0 for j in range(1 << 10)] for i in range(le)]S = 0for i in range(le):for n in range(int(N[i])):if i == 0 and n == 0:continuedp[i][S ^ (1 << n)] += 1S ^= (1 << int(N[i]))if i == 0:continuefor n in range(1,10):dp[i][1 << n] += 1for j in range(1 << 10):for n in range(10):dp[i][j ^ (1 << n)] = (dp[i][j ^ (1<<n)] + dp[i-1][j]) % modif S == 0:dp[-1][0] += 1ans = dp[-1][0] % modprint(ans)