結果
問題 | No.451 575 |
ユーザー | is_eri23 |
提出日時 | 2016-12-17 01:54:17 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 269 ms / 2,000 ms |
コード長 | 1,264 bytes |
コンパイル時間 | 538 ms |
コンパイル使用メモリ | 6,692 KB |
実行使用メモリ | 13,172 KB |
最終ジャッジ日時 | 2023-08-22 14:15:38 |
合計ジャッジ時間 | 6,136 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 17 ms
6,932 KB |
testcase_01 | AC | 17 ms
6,964 KB |
testcase_02 | AC | 17 ms
6,788 KB |
testcase_03 | AC | 17 ms
6,764 KB |
testcase_04 | AC | 17 ms
6,820 KB |
testcase_05 | AC | 28 ms
7,036 KB |
testcase_06 | AC | 54 ms
7,372 KB |
testcase_07 | AC | 234 ms
9,988 KB |
testcase_08 | AC | 16 ms
6,764 KB |
testcase_09 | AC | 19 ms
6,840 KB |
testcase_10 | AC | 79 ms
8,336 KB |
testcase_11 | AC | 209 ms
11,512 KB |
testcase_12 | AC | 269 ms
13,092 KB |
testcase_13 | AC | 268 ms
13,056 KB |
testcase_14 | AC | 17 ms
6,944 KB |
testcase_15 | AC | 23 ms
7,044 KB |
testcase_16 | AC | 48 ms
7,456 KB |
testcase_17 | AC | 218 ms
9,840 KB |
testcase_18 | AC | 218 ms
9,840 KB |
testcase_19 | AC | 148 ms
8,620 KB |
testcase_20 | AC | 26 ms
7,128 KB |
testcase_21 | AC | 19 ms
6,864 KB |
testcase_22 | AC | 17 ms
6,800 KB |
testcase_23 | AC | 269 ms
13,172 KB |
testcase_24 | AC | 160 ms
9,628 KB |
testcase_25 | AC | 17 ms
6,836 KB |
testcase_26 | AC | 17 ms
6,976 KB |
testcase_27 | AC | 17 ms
6,828 KB |
testcase_28 | AC | 19 ms
6,996 KB |
testcase_29 | AC | 37 ms
7,128 KB |
testcase_30 | AC | 219 ms
9,844 KB |
testcase_31 | AC | 17 ms
6,940 KB |
testcase_32 | AC | 94 ms
7,652 KB |
ソースコード
from Queue import * # Queue, LifoQueue, PriorityQueue from bisect import * #bisect, insort from collections import * #deque, Counter,OrderedDict,defaultdict #set([]) import math import copy import itertools import string import sys myread = lambda : map(int,raw_input().split()) def solver(): N = int(raw_input()) b = [int(raw_input()) for i in xrange(N)] cur = 0 lu = [1,10**18] for i in xrange(N): if i % 4 == 0: cur = b[i] - cur lu[1] = min(cur - 1, lu[1]) lu[0] = max(cur - 10**18, lu[0]) elif i % 4 == 1: cur = cur - b[i] lu[1] = min(cur - 1, lu[1]) lu[0] = max(cur - 10**18, lu[0]) elif i % 4 == 2: cur = b[i] - cur lu[1] = min(10**18 - cur, lu[1]) lu[0] = max(1 - cur, lu[0]) else: cur = cur - b[i] lu[1] = min(10**18 - cur, lu[1]) lu[0] = max(1 - cur, lu[0]) if lu[0] > lu[1]: print -1 return a = [lu[0]] for i in xrange(N): if i % 2 == 0: a.append(b[i] - a[-1]) else: a.append(a[-1] - b[i]) print len(a) for x in a: print x if __name__ == "__main__": solver()