結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2015-10-12 13:23:28 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 408 bytes |
コンパイル時間 | 47 ms |
コンパイル使用メモリ | 6,784 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2024-07-21 07:17:09 |
合計ジャッジ時間 | 1,025 ms |
ジャッジサーバーID (参考情報) |
judge3 / 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