結果
問題 | No.3041 非対称じゃんけん |
ユーザー |
![]() |
提出日時 | 2025-02-28 22:43:04 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 988 bytes |
コンパイル時間 | 349 ms |
コンパイル使用メモリ | 82,524 KB |
実行使用メモリ | 89,096 KB |
最終ジャッジ日時 | 2025-02-28 22:43:17 |
合計ジャッジ時間 | 10,678 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 24 TLE * 1 -- * 5 |
ソースコード
n, f = map(int, input().split())A = list(map(int, input().split()))B = list(map(int, input().split()))C = list(map(int, input().split()))N = 0L = 63for i in range(n):N += max(A[i], B[i], C[i])dp = [0 for _ in range(((N+1)//L)+1)]dp[0] |= 1K = ((N+1)//L)+1T = 1 << LT -= 1def popcnt3(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 cfor i in range(n):ndp = [0 for _ in range(((N+1)//L)+1)]ans = 0tmp = 0for j in range(K):tmp |= dp[j] << A[i] | dp[j] << B[i] | dp[j] << C[i]ndp[j] = tmp & Ttmp >>= Lans += popcnt3(ndp[j])print(ans)dp = ndp