結果

問題 No.451 575
ユーザー sette-pianisette-piani
提出日時 2017-01-23 16:42:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 809 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 14,212 KB
最終ジャッジ日時 2023-08-24 21:29:36
合計ジャッジ時間 7,217 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,780 KB
testcase_01 AC 16 ms
7,764 KB
testcase_02 AC 16 ms
7,772 KB
testcase_03 AC 16 ms
7,760 KB
testcase_04 AC 15 ms
7,760 KB
testcase_05 AC 27 ms
8,432 KB
testcase_06 AC 54 ms
9,268 KB
testcase_07 AC 227 ms
14,212 KB
testcase_08 AC 16 ms
7,916 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 282 ms
12,856 KB
testcase_14 AC 16 ms
7,772 KB
testcase_15 AC 23 ms
8,336 KB
testcase_16 AC 48 ms
8,848 KB
testcase_17 AC 221 ms
12,540 KB
testcase_18 AC 220 ms
12,572 KB
testcase_19 AC 150 ms
11,196 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 15 ms
7,940 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 16 ms
7,932 KB
testcase_26 AC 15 ms
7,864 KB
testcase_27 AC 17 ms
7,820 KB
testcase_28 AC 18 ms
8,324 KB
testcase_29 AC 37 ms
8,668 KB
testcase_30 AC 227 ms
13,100 KB
testcase_31 AC 16 ms
7,772 KB
testcase_32 AC 86 ms
10,072 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 0 < a0 and 0 < a1:
        print(n+1)
        [print(i) for i in a]
    elif a1 <= 0:
        print(-1)
    else:
        if a0 + a1 >= 2:
            print(n+1)
            [print(i+1-a0) for i in 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