結果
問題 | No.178 美しいWhitespace (1) |
ユーザー |
![]() |
提出日時 | 2016-11-05 15:05:55 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 822 bytes |
コンパイル時間 | 3,220 ms |
コンパイル使用メモリ | 111,480 KB |
実行使用メモリ | 28,916 KB |
最終ジャッジ日時 | 2024-11-25 03:09:39 |
合計ジャッジ時間 | 3,877 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Magatro { static void Main() { long ans = 0; int N = int.Parse(Console.ReadLine()); long[] a = new long[N]; for(int i = 0; i < N; i++) { string[] s = Console.ReadLine().Split(' '); int w = int.Parse(s[0]); w += int.Parse(s[1]) * 4; a[i] = w; } long max = a.Max(); for(int i = 0; i < N; i++) { long p = (max - a[i]); if (p % 2 == 1) { Console.WriteLine(-1); return; } else { ans += p / 2; } } Console.WriteLine(ans); } }