結果
問題 | No.3041 非対称じゃんけん |
ユーザー |
![]() |
提出日時 | 2025-02-28 22:39:41 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,024 bytes |
コンパイル時間 | 381 ms |
コンパイル使用メモリ | 82,892 KB |
実行使用メモリ | 119,604 KB |
最終ジャッジ日時 | 2025-02-28 22:39:54 |
合計ジャッジ時間 | 10,249 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 = 60for 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 = 0for j in range(K):tmp = dp[j] << Lif j:tmp |= dp[j-1]now = tmp << A[i] | tmp << B[i] | tmp << C[i]ndp[j] = (now >> L) & Tans += popcnt3(ndp[j])print(ans)dp = ndp