結果

問題 No.178 美しいWhitespace (1)
ユーザー mban
提出日時 2016-11-05 14:59:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 817 bytes
コンパイル時間 4,377 ms
コンパイル使用メモリ 109,184 KB
実行使用メモリ 26,972 KB
最終ジャッジ日時 2024-11-25 03:09:13
合計ジャッジ時間 2,180 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 7 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Magatro
{
    static void Main()
    {
        int ans = 0;
        int N = int.Parse(Console.ReadLine());
        int[] a = new int[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;
        }
        int max = a.Max();
        for(int i = 0; i < N; i++)
        {
            int p = (max - a[i]);
            if (p % 2 == 1)
            {
                Console.WriteLine(-1);
                return;
            }
            else
            {
                ans += p / 2;
            }
        }
        Console.WriteLine(ans);
    }
}
0