結果

問題 No.451 575
ユーザー _____TAB__________TAB_____
提出日時 2016-12-02 12:02:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 746 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 17,712 KB
最終ジャッジ日時 2023-08-22 13:02:44
合計ジャッジ時間 7,580 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,284 KB
testcase_01 AC 16 ms
8,272 KB
testcase_02 AC 16 ms
8,280 KB
testcase_03 AC 16 ms
8,272 KB
testcase_04 AC 17 ms
8,160 KB
testcase_05 AC 32 ms
8,756 KB
testcase_06 AC 69 ms
10,012 KB
testcase_07 AC 298 ms
17,712 KB
testcase_08 AC 17 ms
8,284 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 395 ms
16,208 KB
testcase_14 AC 16 ms
8,304 KB
testcase_15 AC 26 ms
8,532 KB
testcase_16 AC 60 ms
9,536 KB
testcase_17 AC 294 ms
16,232 KB
testcase_18 WA -
testcase_19 AC 205 ms
13,696 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 17 ms
7,880 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 16 ms
8,220 KB
testcase_26 AC 17 ms
8,224 KB
testcase_27 AC 17 ms
8,300 KB
testcase_28 AC 20 ms
8,268 KB
testcase_29 AC 44 ms
9,040 KB
testcase_30 AC 298 ms
16,904 KB
testcase_31 AC 16 ms
8,276 KB
testcase_32 AC 111 ms
11,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n  = int(input())
b = []
f = 0
a_01 = []
a_23 = [1]
m_01 = 1
m_23 = 1

for i in range(n):
	b.append(int(input()))
	if f <= 1:
		if f == 0:
			ai = b[i] - a_23[-1]
		else:
			ai = a_01[-1] - b[i]
		a_01.append(ai)
		m_01 = min(m_01, ai)
	else:
		if f == 2:
			ai = b[i] - a_01[-1]
		else:
			ai = a_23[-1] - b[i]
		a_23.append(ai)
		m_23 = min(m_23, ai)
	f = (f + 1) % 4

if n == 1 and a_01[0] == 0:
	print(-1)
	exit()

#print(a_01)
#print(a_23)

if m_23 + m_01 <= 0:
	print(-1)
else:
	f = 3
	a_01.reverse()
	a_23.reverse()
	print(n+1)
	if m_01 > 0 and m_23 > 0:
		m = 0
	elif m_01 < m_23:
		m = -m_01 + 1
	else:
		m = m_23 - 1

	for i in range(n + 1):
		if f <= 1:
			a = a_01.pop() + m
		else:
			a = a_23.pop() - m
		f = (f + 1) % 4
		print(a)
0