結果

問題 No.451 575
ユーザー sette-pianisette-piani
提出日時 2017-01-23 16:59:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 298 ms / 2,000 ms
コード長 829 bytes
コンパイル時間 580 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 14,420 KB
最終ジャッジ日時 2023-08-24 21:31:44
合計ジャッジ時間 6,265 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,880 KB
testcase_01 AC 16 ms
7,956 KB
testcase_02 AC 16 ms
7,868 KB
testcase_03 AC 16 ms
7,864 KB
testcase_04 AC 16 ms
7,800 KB
testcase_05 AC 31 ms
8,472 KB
testcase_06 AC 66 ms
9,272 KB
testcase_07 AC 283 ms
14,420 KB
testcase_08 AC 16 ms
7,916 KB
testcase_09 AC 18 ms
8,292 KB
testcase_10 AC 86 ms
9,620 KB
testcase_11 AC 235 ms
11,816 KB
testcase_12 AC 294 ms
12,824 KB
testcase_13 AC 295 ms
12,920 KB
testcase_14 AC 16 ms
7,848 KB
testcase_15 AC 23 ms
8,364 KB
testcase_16 AC 49 ms
8,924 KB
testcase_17 AC 223 ms
12,620 KB
testcase_18 AC 276 ms
12,748 KB
testcase_19 AC 152 ms
11,280 KB
testcase_20 AC 27 ms
8,284 KB
testcase_21 AC 18 ms
8,396 KB
testcase_22 AC 16 ms
7,864 KB
testcase_23 AC 298 ms
13,424 KB
testcase_24 AC 178 ms
11,300 KB
testcase_25 AC 15 ms
7,776 KB
testcase_26 AC 16 ms
7,852 KB
testcase_27 AC 17 ms
8,256 KB
testcase_28 AC 17 ms
8,196 KB
testcase_29 AC 37 ms
8,664 KB
testcase_30 AC 236 ms
13,492 KB
testcase_31 AC 16 ms
7,912 KB
testcase_32 AC 107 ms
10,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    a = [1]

    for i in range(n):
        a.append(int(input()) - a[i] if i%2 == 0 else a[i] - int(input()))
    a0 = min([a[i] for i in range(n+1) if i % 4 == 0 or i%4 == 3])
    a1 = min([a[i] for i in range(n+1) if i % 4 == 1 or i%4 == 2])
    if a1 < 1:
        print(-1)
        [print(i) for i in a]
    else:
        if a0 + a1 >= 2:
            print(n+1)
            [print(a[i]+1-a0) if  i % 4 == 0 or i%4 == 3 else print(a[i] - 1 + a0) for i in range(len(a))]
        else:
            print(-1)


if __name__ == "__main__":
    import sys
    import os
    if len(sys.argv) > 1:
        if sys.argv[1] == "-d":
            filename = "input1.txt"
            fd = os.open(filename, os.O_RDONLY)
            os.dup2(fd, sys.stdin.fileno())
            main()
    else:
        main()
0