結果
問題 | No.2407 Bouns 2.0 |
ユーザー | mattu34 |
提出日時 | 2023-09-12 14:19:50 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 49 ms / 2,000 ms |
コード長 | 5,038 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 82,380 KB |
実行使用メモリ | 55,936 KB |
最終ジャッジ日時 | 2024-06-30 02:23:49 |
合計ジャッジ時間 | 2,146 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 49 ms
55,296 KB |
testcase_01 | AC | 47 ms
55,424 KB |
testcase_02 | AC | 45 ms
55,168 KB |
testcase_03 | AC | 45 ms
55,680 KB |
testcase_04 | AC | 45 ms
55,168 KB |
testcase_05 | AC | 46 ms
55,808 KB |
testcase_06 | AC | 45 ms
55,296 KB |
testcase_07 | AC | 46 ms
55,552 KB |
testcase_08 | AC | 47 ms
55,552 KB |
testcase_09 | AC | 45 ms
55,296 KB |
testcase_10 | AC | 45 ms
55,936 KB |
testcase_11 | AC | 46 ms
55,680 KB |
testcase_12 | AC | 46 ms
55,808 KB |
testcase_13 | AC | 46 ms
55,680 KB |
testcase_14 | AC | 48 ms
55,296 KB |
testcase_15 | AC | 46 ms
55,168 KB |
testcase_16 | AC | 46 ms
55,808 KB |
testcase_17 | AC | 45 ms
55,808 KB |
testcase_18 | AC | 46 ms
55,552 KB |
testcase_19 | AC | 46 ms
55,424 KB |
ソースコード
from collections import * import heapq import bisect import itertools class UnionFind: def __init__(self, n): self.n = n self.parents = [-1] * n def find(self, x): if self.parents[x] < 0: return x else: self.parents[x] = self.find(self.parents[x]) return self.parents[x] def union(self, x, y): x = self.find(x) y = self.find(y) if x == y: return if self.parents[x] > self.parents[y]: x, y = y, x self.parents[x] += self.parents[y] self.parents[y] = x def size(self, x): return -self.parents[self.find(x)] def same(self, x, y): return self.find(x) == self.find(y) def members(self, x): # 多用すると重い root = self.find(x) return [i for i in range(self.n) if self.find(i) == root] def roots(self): return [i for i, x in enumerate(self.parents) if x < 0] def group_count(self): return len(self.roots()) def all_group_members(self): group_members = defaultdict(list) for member in range(self.n): group_members[self.find(member)].append(member) return group_members def __str__(self): return "\n".join(f"{r}: {m}" for r, m in self.all_group_members().items()) # https://raw.githubusercontent.com/shakayami/ACL-for-python/master/segtree.py class segtree: n = 1 size = 1 log = 2 d = [0] op = None e = 10**15 def __init__(self, V, OP, E): self.n = len(V) self.op = OP self.e = E self.log = (self.n - 1).bit_length() self.size = 1 << self.log self.d = [E for i in range(2 * self.size)] for i in range(self.n): self.d[self.size + i] = V[i] for i in range(self.size - 1, 0, -1): self.update(i) def set(self, p, x): assert 0 <= p and p < self.n p += self.size self.d[p] = x for i in range(1, self.log + 1): self.update(p >> i) def get(self, p): assert 0 <= p and p < self.n return self.d[p + self.size] def prod(self, l, r): assert 0 <= l and l <= r and r <= self.n sml = self.e smr = self.e l += self.size r += self.size while l < r: if l & 1: sml = self.op(sml, self.d[l]) l += 1 if r & 1: smr = self.op(self.d[r - 1], smr) r -= 1 l >>= 1 r >>= 1 return self.op(sml, smr) def all_prod(self): return self.d[1] def max_right(self, l, f): assert 0 <= l and l <= self.n assert f(self.e) if l == self.n: return self.n l += self.size sm = self.e while 1: while l % 2 == 0: l >>= 1 if not (f(self.op(sm, self.d[l]))): while l < self.size: l = 2 * l if f(self.op(sm, self.d[l])): sm = self.op(sm, self.d[l]) l += 1 return l - self.size sm = self.op(sm, self.d[l]) l += 1 if (l & -l) == l: break return self.n def min_left(self, r, f): assert 0 <= r and r <= self.n assert f(self.e) if r == 0: return 0 r += self.size sm = self.e while 1: r -= 1 while r > 1 and (r % 2): r >>= 1 if not (f(self.op(self.d[r], sm))): while r < self.size: r = 2 * r + 1 if f(self.op(self.d[r], sm)): sm = self.op(self.d[r], sm) r -= 1 return r + 1 - self.size sm = self.op(self.d[r], sm) if (r & -r) == r: break return 0 def update(self, k): self.d[k] = self.op(self.d[2 * k], self.d[2 * k + 1]) def __str__(self): return str([self.get(i) for i in range(self.n)]) def get_list(self): return [self.get(i) for i in range(self.n)] # オリジナルで追加 # RMQのとき # def op(x, y): # return x if x < y else y # seg = segtree([10**9] * N, op, 10**9) # Vの要素とEの値は同じにする #10**9 -> INF # seg.prod(l, r) # op(a[l],...a[r-1])を返す # リストを渡すと座標圧縮して返してくれる def compress(arr): (*XS,) = set(arr) XS.sort() return {cmp_e: cmp_i for cmp_i, cmp_e in enumerate(XS)} def ctov(c): return ord(c) - ord("a") def CTOV(c): return ord(c) - ord("A") dxdy1 = ((0, 1), (0, -1), (1, 0), (-1, 0)) dxdy2 = ((0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, -1), (1, -1), (-1, 1)) dxdy3 = ((0, 1), (1, 0)) INF = float("inf") MOD = 998244353 mod = 998244353 W, Z, B = map(float, input().split()) print(int((W + Z) * (1.0 + B)))