結果

問題 No.2233 Average
ユーザー タコイモタコイモ
提出日時 2023-03-03 21:41:16
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,693 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 81,456 KB
実行使用メモリ 78,440 KB
最終ジャッジ日時 2023-10-18 01:37:36
合計ジャッジ時間 6,137 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
55,304 KB
testcase_01 WA -
testcase_02 AC 43 ms
55,304 KB
testcase_03 AC 43 ms
55,304 KB
testcase_04 AC 42 ms
55,304 KB
testcase_05 AC 43 ms
55,304 KB
testcase_06 AC 44 ms
55,304 KB
testcase_07 AC 50 ms
63,560 KB
testcase_08 AC 367 ms
77,288 KB
testcase_09 AC 529 ms
78,104 KB
testcase_10 AC 476 ms
77,192 KB
testcase_11 AC 463 ms
77,156 KB
testcase_12 AC 415 ms
76,968 KB
testcase_13 AC 140 ms
75,976 KB
testcase_14 AC 317 ms
76,996 KB
testcase_15 AC 403 ms
77,504 KB
testcase_16 AC 159 ms
76,204 KB
testcase_17 AC 188 ms
76,296 KB
testcase_18 AC 584 ms
78,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
#####segfunc#####
def segfunc(x, y):
    return max(x,y)
#################
#####ide_ele#####
ide_ele = 0
#################
class SegTree:
    """
    init(init_val, ide_ele): 配列init_valで初期化 O(N)
    update(k, x): k番目の値をxに更新 O(logN)
    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
    """
    def __init__(self, init_val, segfunc, ide_ele):
        """
        init_val: 配列の初期値
        segfunc: 区間にしたい操作
        ide_ele: 単位元
        n: 要素数
        num: n以上の最小の2のべき乗
        tree: セグメント木(1-index)
        """
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        # 配列の値を葉にセット
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        # 構築していく
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])
    def update(self, k, x):
        """
        k番目の値をxに更新
        k: index(0-index)
        x: update value
        """
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1
    def query(self, l, r):
        """
        [l, r)のsegfuncしたものを得る
        l: index(0-index)
        r: index(0-index)
        """
        res = self.ide_ele
        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res


import sys
#sys.setrecursionlimit(500000)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def TI(): return tuple(map(int,sys.stdin.readline().rstrip().split()))
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip())
#for i, pi in enumerate(p):
from collections import defaultdict,deque
import bisect
import itertools
dic = defaultdict(int)
d = deque()
YN = ['No','Yes']

T = I()
for _ in range(T):
  a,b,c,K = MI()
  S = [a,b,c]
  S.sort()
  for i in range(K):
    a,b,c = S
    d = (b+c)//2
    e = (c+a)//2
    f = (a+b)//2
    SS = [d,e,f]
    SS.sort()
    
    if S == SS:
      break
    S = SS
  print(a+b+c)
0