結果

問題 No.178 美しいWhitespace (1)
ユーザー mbanmban
提出日時 2016-11-05 14:59:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 817 bytes
コンパイル時間 3,294 ms
コンパイル使用メモリ 102,104 KB
実行使用メモリ 23,520 KB
最終ジャッジ日時 2023-08-16 13:53:26
合計ジャッジ時間 4,888 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
23,468 KB
testcase_01 AC 57 ms
23,380 KB
testcase_02 AC 58 ms
23,404 KB
testcase_03 AC 57 ms
21,420 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 59 ms
21,324 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 59 ms
23,308 KB
testcase_12 AC 59 ms
21,552 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 60 ms
21,340 KB
testcase_19 WA -
testcase_20 AC 58 ms
21,372 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 57 ms
21,504 KB
testcase_24 AC 57 ms
21,424 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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