結果
| 問題 | 
                            No.1004 サイコロの実装 (2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             wagasa2
                         | 
                    
| 提出日時 | 2020-03-07 01:10:12 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 767 bytes | 
| コンパイル時間 | 84 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 821,376 KB | 
| 最終ジャッジ日時 | 2024-10-14 11:00:26 | 
| 合計ジャッジ時間 | 3,942 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 6 WA * 8 MLE * 1 -- * 23 | 
ソースコード
def lcgs(a, b, x_0, m=2**32):
    x = x_0
    while True:
        x = (a*x + b) % m
        yield x
def f(lst):
    return [lst[0:i+1] for i in range(len(lst))]
def get_space(xs, step, n_people=2):
    return [sum(x) for x in f(xs[step::n_people])]
def num_black(lst_space):
    return sum([1 for s in lst_space if s % 2 == 1])
def num_white(lst_space):
    return sum([1 for s in lst_space if s % 2 == 0])
def cal_score(n_black, n_white):
    return min([n_black, n_white])
n = 2
a, b, x_0, N = tuple(map(int, input().split()))
g = lcgs(a, b, x_0)
xs = [next(g) for i in range(n*N)]
space = [get_space(xs, i) for i in range(n)]
score = [cal_score(num_black(lst), num_white(lst)) for lst in space]
score = [" ".join(map(str, score))]
p = list(map(print, score))
            
            
            
        
            
wagasa2