結果

問題 No.1004 サイコロの実装 (2)
ユーザー integerinteger
提出日時 2020-05-02 15:58:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,133 bytes
コンパイル時間 864 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 12,724 KB
最終ジャッジ日時 2023-08-28 20:09:36
合計ジャッジ時間 5,420 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
12,724 KB
testcase_01 AC 15 ms
8,176 KB
testcase_02 AC 15 ms
8,340 KB
testcase_03 AC 15 ms
8,164 KB
testcase_04 AC 15 ms
8,256 KB
testcase_05 AC 16 ms
8,268 KB
testcase_06 AC 16 ms
8,216 KB
testcase_07 AC 15 ms
8,228 KB
testcase_08 AC 15 ms
8,276 KB
testcase_09 AC 15 ms
8,228 KB
testcase_10 AC 16 ms
8,272 KB
testcase_11 AC 15 ms
8,216 KB
testcase_12 AC 16 ms
8,076 KB
testcase_13 AC 15 ms
8,252 KB
testcase_14 AC 15 ms
8,268 KB
testcase_15 AC 15 ms
8,324 KB
testcase_16 AC 29 ms
8,172 KB
testcase_17 AC 68 ms
8,204 KB
testcase_18 AC 16 ms
8,276 KB
testcase_19 AC 20 ms
8,168 KB
testcase_20 AC 16 ms
8,216 KB
testcase_21 AC 63 ms
8,320 KB
testcase_22 AC 19 ms
8,264 KB
testcase_23 AC 22 ms
8,288 KB
testcase_24 AC 57 ms
8,204 KB
testcase_25 AC 46 ms
8,340 KB
testcase_26 TLE -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

class Player:
    def __init__(self, name):
        self.name = name
        self.black = 0
        self.white = 0
        self.pos = 0
    def forward(self, x):
        self.pos += x
        if self.pos % 2:
            self.black += 1
        else:
            self.white += 1
    def getpoint(self):
        return min(self.black, self.white)

def main():
    a, b, x0, n = map(int, input().split())
    ans = solve(a, b, x0, n)
    print(*ans)

def solve(a, b, x, n):
    m = 2 ** 32 - 1
    takahashi, aoki = Player('takahashi'), Player('aoki')
    for _ in range(n):
        x = rand(a, b, x, m)
        takahashi.forward(saikoro(x))
        x = rand(a, b, x, m)
        aoki.forward(saikoro(x))
    return takahashi.getpoint(), aoki.getpoint()

def rand(a, b, x, m):
    return (a * x + b) & m

def saikoro(x):
    return x % 6 + 1

def test():
    n = 4
    a, b, x0, m= map(int, input('a b x0 m\n').split())
    x = [x0 for _ in range(n * 2 + 1)]
    for i in range(n * 2):
        x[i + 1] = rand(a, b, x[i], m)
    print(*['x{}:{}'.format(i, x) for i, x in enumerate(x)], sep = '\n')

if __name__ == '__main__':
    main()
0