結果
問題 | No.3041 非対称じゃんけん |
ユーザー |
![]() |
提出日時 | 2025-02-28 21:54:53 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 998 bytes |
コンパイル時間 | 138 ms |
コンパイル使用メモリ | 82,660 KB |
実行使用メモリ | 275,352 KB |
最終ジャッジ日時 | 2025-02-28 21:55:01 |
合計ジャッジ時間 | 8,097 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 WA * 16 TLE * 1 -- * 9 |
ソースコード
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 = 0for i in range(n):N += max(A[i], B[i], C[i])dp = [0 for _ in range(((N+1)//63)+1)]dp[0] |= 1K = ((N+1)//63)+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)//63)+1)]ans = 0for j in range(K):tmp = dp[j] << 63if j:tmp |= dp[j-1]now = tmp << A[i] | tmp << B[i] | tmp << C[i]ndp[j] = now >> 63ans += popcnt3(ndp[j])print(ans)dp = ndp