結果
| 問題 |
No.3041 非対称じゃんけん
|
| コンテスト | |
| ユーザー |
kidodesu
|
| 提出日時 | 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 = 0
L = 63
for i in range(n):
N += max(A[i], B[i], C[i])
dp = [0 for _ in range(((N+1)//L)+1)]
dp[0] |= 1
K = ((N+1)//L)+1
T = 1 << L
T -= 1
def 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 c
for i in range(n):
ndp = [0 for _ in range(((N+1)//L)+1)]
ans = 0
tmp = 0
for j in range(K):
tmp |= dp[j] << A[i] | dp[j] << B[i] | dp[j] << C[i]
ndp[j] = tmp & T
tmp >>= L
ans += popcnt3(ndp[j])
print(ans)
dp = ndp
kidodesu