結果
問題 | No.2375 watasou and hibit's baseball |
ユーザー | mo124121 |
提出日時 | 2023-07-07 23:12:19 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,715 bytes |
コンパイル時間 | 364 ms |
コンパイル使用メモリ | 82,156 KB |
実行使用メモリ | 125,144 KB |
最終ジャッジ日時 | 2024-07-21 19:35:24 |
合計ジャッジ時間 | 7,226 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
52,736 KB |
testcase_01 | AC | 37 ms
52,480 KB |
testcase_02 | AC | 36 ms
52,864 KB |
testcase_03 | AC | 155 ms
98,176 KB |
testcase_04 | WA | - |
testcase_05 | AC | 44 ms
59,904 KB |
testcase_06 | AC | 366 ms
124,636 KB |
testcase_07 | AC | 38 ms
52,224 KB |
testcase_08 | AC | 82 ms
83,116 KB |
testcase_09 | AC | 36 ms
52,096 KB |
testcase_10 | AC | 39 ms
52,864 KB |
testcase_11 | AC | 51 ms
66,304 KB |
testcase_12 | AC | 203 ms
124,160 KB |
testcase_13 | WA | - |
testcase_14 | AC | 36 ms
52,536 KB |
testcase_15 | AC | 86 ms
80,512 KB |
testcase_16 | AC | 66 ms
71,680 KB |
testcase_17 | WA | - |
testcase_18 | AC | 38 ms
53,248 KB |
testcase_19 | AC | 36 ms
52,736 KB |
testcase_20 | AC | 52 ms
66,304 KB |
testcase_21 | AC | 203 ms
124,628 KB |
testcase_22 | AC | 38 ms
52,864 KB |
testcase_23 | AC | 189 ms
124,032 KB |
testcase_24 | AC | 187 ms
124,032 KB |
testcase_25 | AC | 37 ms
52,096 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | AC | 245 ms
124,416 KB |
testcase_29 | AC | 258 ms
124,416 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 258 ms
124,672 KB |
testcase_34 | WA | - |
testcase_35 | AC | 291 ms
124,796 KB |
testcase_36 | AC | 270 ms
124,544 KB |
testcase_37 | AC | 231 ms
124,288 KB |
testcase_38 | AC | 185 ms
124,160 KB |
ソースコード
from itertools import permutations N, A, B = map(int, input().split()) XYK = [] for _ in range(N): x, y, k = map(int, input().split()) XYK.append((x, y, k)) coef = [[[0] * (N + 1) for _ in range(N + 1)] for _ in range(N + 1)] def dist(z1, z2): return abs(z1[0] - z2[0]) + abs(z1[1] - z2[1]) for (i, zi), (j, zj) in permutations(enumerate(XYK), 2): if A <= dist(zi, zj): coef[N][i][j] = 1 if B <= abs(zi[2] - zj[2]): for k in range(N + 1): coef[k][i][j] = 1 for (i, zi), (j, zj), (k, zk) in permutations(enumerate(XYK), 3): if A <= dist(zi, zj) + dist(zj, zk): coef[i][j][k] = 1 dp = [[[0] * (N + 1) for _ in range(N + 1)] for _ in range(1 << N)] for i in range(N): dp[1 << i][N][i] = 1 def popcount(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 ans = 0 for group in range(1, 1 << N): flag = False for i in range(N + 1): for j in range(N): if i == j: continue if dp[group][i][j] == 0: continue flag = True for k in range(N): nxt = group | (1 << k) if nxt == group: continue if coef[i][j][k]: dp[nxt][j][k] = 1 if flag: ans = max(ans, popcount(group)) print(ans)