結果
| 問題 | No.178 美しいWhitespace (1) |
| コンテスト | |
| ユーザー |
steek79
|
| 提出日時 | 2015-10-12 13:23:28 |
| 言語 | Python2 (2.7.18) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 408 bytes |
| 記録 | |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-12-03 17:25:17 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
ソースコード
N = int(raw_input())
max = None
ans = 0
for i in range(N):
spc, tab = map(int, raw_input().split())
length = spc + 4 * tab
if max is None:
max = length
elif (max - length)%2 != 0:
ans = -1
break
elif max > length:
ans += abs(max - length)/2
elif max < length:
ans += abs(max - length)/2 * i
max = length
else: continue
print ans
steek79