結果
問題 | No.1246 ANDORゲーム(max) |
ユーザー | 👑 tute7627 |
提出日時 | 2020-08-04 18:59:50 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 471 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 10,812 KB |
実行使用メモリ | 20,092 KB |
最終ジャッジ日時 | 2023-10-12 21:30:06 |
合計ジャッジ時間 | 5,257 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
12,292 KB |
testcase_01 | AC | 16 ms
7,800 KB |
testcase_02 | AC | 16 ms
7,820 KB |
testcase_03 | AC | 15 ms
7,800 KB |
testcase_04 | AC | 15 ms
7,840 KB |
testcase_05 | AC | 16 ms
7,916 KB |
testcase_06 | AC | 16 ms
7,796 KB |
testcase_07 | AC | 15 ms
7,916 KB |
testcase_08 | AC | 15 ms
7,908 KB |
testcase_09 | AC | 16 ms
7,792 KB |
testcase_10 | AC | 16 ms
7,816 KB |
testcase_11 | AC | 156 ms
15,592 KB |
testcase_12 | AC | 41 ms
9,608 KB |
testcase_13 | AC | 63 ms
10,588 KB |
testcase_14 | AC | 244 ms
20,092 KB |
testcase_15 | AC | 246 ms
19,956 KB |
testcase_16 | TLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
ソースコード
n,t = map(int,input().split()) a = list(map(int,input().split())) dp = [] for i in range(n+1): dp.append({}) dp[0][t] = 0 for i in range(n): for now, score in dp[i].items(): for j in range(2): nxt = now & a[i] if j == 1: nxt = now | a[i] nxtscore = score + abs(now - nxt) if not (nxt in dp[i+1]) or dp[i+1][nxt] < nxtscore: dp[i+1][nxt] = nxtscore print(max(dp[n].values()))