結果
問題 | No.511 落ちゲー 〜手作業のぬくもり〜 |
ユーザー | maspy |
提出日時 | 2020-04-08 17:45:07 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 990 ms / 4,000 ms |
コード長 | 2,127 bytes |
コンパイル時間 | 1,332 ms |
コンパイル使用メモリ | 87,172 KB |
実行使用メモリ | 193,536 KB |
最終ジャッジ日時 | 2023-08-16 03:11:23 |
合計ジャッジ時間 | 11,830 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 61 ms
71,480 KB |
testcase_01 | AC | 64 ms
71,380 KB |
testcase_02 | AC | 64 ms
71,340 KB |
testcase_03 | AC | 61 ms
71,404 KB |
testcase_04 | AC | 65 ms
71,224 KB |
testcase_05 | AC | 65 ms
71,528 KB |
testcase_06 | AC | 65 ms
71,492 KB |
testcase_07 | AC | 63 ms
71,456 KB |
testcase_08 | AC | 65 ms
71,536 KB |
testcase_09 | AC | 64 ms
71,480 KB |
testcase_10 | AC | 62 ms
71,220 KB |
testcase_11 | AC | 61 ms
71,452 KB |
testcase_12 | AC | 63 ms
71,408 KB |
testcase_13 | AC | 62 ms
71,284 KB |
testcase_14 | AC | 62 ms
71,140 KB |
testcase_15 | AC | 61 ms
71,404 KB |
testcase_16 | AC | 63 ms
71,328 KB |
testcase_17 | AC | 64 ms
71,448 KB |
testcase_18 | AC | 65 ms
71,276 KB |
testcase_19 | AC | 64 ms
71,392 KB |
testcase_20 | AC | 62 ms
71,452 KB |
testcase_21 | AC | 89 ms
77,648 KB |
testcase_22 | AC | 87 ms
77,332 KB |
testcase_23 | AC | 87 ms
77,400 KB |
testcase_24 | AC | 77 ms
76,448 KB |
testcase_25 | AC | 92 ms
77,468 KB |
testcase_26 | AC | 88 ms
77,712 KB |
testcase_27 | AC | 101 ms
77,556 KB |
testcase_28 | AC | 102 ms
77,660 KB |
testcase_29 | AC | 990 ms
191,296 KB |
testcase_30 | AC | 854 ms
174,564 KB |
testcase_31 | AC | 769 ms
169,028 KB |
testcase_32 | AC | 859 ms
193,536 KB |
testcase_33 | AC | 714 ms
164,116 KB |
testcase_34 | AC | 668 ms
160,184 KB |
testcase_35 | AC | 958 ms
191,848 KB |
testcase_36 | AC | 975 ms
191,900 KB |
ソースコード
#!/usr/bin/ python3.8 import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines class BinaryIndexedTree(): def __init__(self, seq): self.size = len(seq) self.depth = self.size.bit_length() self.build(seq) def build(self, seq): data = seq size = self.size for i, x in enumerate(data): j = i + (i & (-i)) if j < size: data[j] += data[i] self.data = data def __repr__(self): return self.data.__repr__() def get_sum(self, i): data = self.data s = 0 while i: s += data[i] i -= i & -i return s def add(self, i, x): data = self.data size = self.size while i < size: data[i] += x i += i & -i def find_kth_element(self, k): data = self.data size = self.size x, sx = 0, 0 dx = 1 << (self.depth) for i in range(self.depth - 1, -1, -1): dx = (1 << i) if x + dx >= size: continue y = x + dx sy = sx + data[y] if sy < k: x, sx = y, sy return x + 1 N, W, H = map(int, readline().split()) m = map(int, read().split()) query = tuple(zip(m, m, m)) left = [0] * (W + 1) # 終わっていない right = [0] + [N] * (W) # 終わっている while True: tasks = [[] for _ in range(N + 1)] # 時刻ごとの調べる座標 update = False for i, (x, y) in enumerate(zip(left, right)): if x + 1 < y: z = (x + y) // 2 tasks[z].append(i) update = True if not update: break bit = BinaryIndexedTree([0] * (W + 2)) for t, (a, b, x) in enumerate(query, 1): bit.add(x, b) bit.add(x + a, -b) for w in tasks[t]: if H <= bit.get_sum(w): right[w] = t else: left[w] = t A = sum(x & 1 for x in right[1:]) B = W - A print('A' if A > B else 'B' if B > A else 'DRAW')