結果

問題 No.1869 Doubling?
ユーザー chineristACchineristAC
提出日時 2022-03-11 21:52:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,467 bytes
コンパイル時間 1,022 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 74,748 KB
最終ジャッジ日時 2023-10-14 06:58:56
合計ジャッジ時間 7,327 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
74,500 KB
testcase_01 AC 113 ms
74,352 KB
testcase_02 AC 111 ms
74,468 KB
testcase_03 AC 115 ms
74,456 KB
testcase_04 AC 110 ms
74,508 KB
testcase_05 AC 115 ms
74,508 KB
testcase_06 AC 115 ms
74,264 KB
testcase_07 AC 112 ms
74,292 KB
testcase_08 AC 111 ms
74,220 KB
testcase_09 WA -
testcase_10 AC 113 ms
74,500 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 114 ms
74,456 KB
testcase_16 AC 115 ms
74,504 KB
testcase_17 AC 117 ms
74,264 KB
testcase_18 AC 116 ms
74,272 KB
testcase_19 AC 116 ms
74,492 KB
testcase_20 AC 115 ms
74,268 KB
testcase_21 AC 116 ms
74,236 KB
testcase_22 AC 117 ms
74,224 KB
testcase_23 AC 114 ms
74,036 KB
testcase_24 AC 119 ms
74,492 KB
testcase_25 AC 119 ms
74,376 KB
testcase_26 AC 114 ms
74,448 KB
testcase_27 AC 110 ms
74,460 KB
testcase_28 AC 110 ms
74,496 KB
testcase_29 AC 113 ms
74,292 KB
testcase_30 AC 111 ms
74,400 KB
testcase_31 AC 115 ms
74,264 KB
testcase_32 AC 114 ms
74,688 KB
testcase_33 AC 112 ms
74,376 KB
testcase_34 AC 110 ms
74,220 KB
testcase_35 AC 118 ms
74,228 KB
testcase_36 AC 110 ms
74,500 KB
testcase_37 AC 110 ms
74,708 KB
testcase_38 AC 111 ms
74,192 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 118 ms
74,268 KB
testcase_43 AC 115 ms
74,748 KB
testcase_44 WA -
testcase_45 AC 115 ms
74,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

class SegmentTree:
    def __init__(self, init_val, segfunc, ide_ele):
        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
        self.size = n
        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 += self.num
        self.tree[k] = x
        while k > 1:
            k >>= 1
            self.tree[k] = self.segfunc(self.tree[2*k], self.tree[2*k+1])

    def query(self, l, r):
        if r==self.size:
            r = self.num

        res = self.ide_ele

        l += self.num
        r += self.num
        right = []
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                right.append(self.tree[r-1])
            l >>= 1
            r >>= 1

        for e in right[::-1]:
            res = self.segfunc(res,e)
        return res

    def bisect(self,l,r,x):
        if r==self.size:
            r = self.num
        l += self.num
        r += self.num
        segment = []
        segment_r = []
        while l<r:
            if l&1:
                segment.append(l)
                l += 1
            if r&1:
                segment_r.append(r-1)
            l >>= 1
            r >>= 1
        segment += segment_r[::-1]
        tmp = self.ide_ele
        for pos in segment:
            check = self.segfunc(tmp,self.tree[pos])
            if check > x:
                break
            else:
                tmp = check
        else:
            return -1
        
        while pos < self.num:
            check = self.segfunc(tmp,self.tree[2*pos])
            if check > x:
                pos = 2 * pos
            else:
                tmp = check
                pos = 2 * pos + 1
        return pos - self.num

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import log,gcd

input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

N,M = mi()
A = [M]
for i in range(40):
    A.append((A[-1]+1)//2)

if N < len(A):
    print(sum(A[:N]))
else:
    print(sum(A)+N-len(A))

    
0