結果

問題 No.178 美しいWhitespace (1)
ユーザー mbanmban
提出日時 2016-11-05 15:05:55
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 822 bytes
コンパイル時間 2,661 ms
コンパイル使用メモリ 103,504 KB
実行使用メモリ 23,468 KB
最終ジャッジ日時 2023-08-16 13:53:57
合計ジャッジ時間 4,722 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,324 KB
testcase_01 AC 58 ms
21,336 KB
testcase_02 AC 58 ms
23,436 KB
testcase_03 AC 60 ms
23,392 KB
testcase_04 AC 61 ms
21,524 KB
testcase_05 AC 61 ms
21,368 KB
testcase_06 AC 61 ms
23,348 KB
testcase_07 AC 60 ms
21,352 KB
testcase_08 AC 60 ms
21,584 KB
testcase_09 AC 61 ms
19,216 KB
testcase_10 AC 61 ms
21,328 KB
testcase_11 AC 61 ms
21,368 KB
testcase_12 AC 61 ms
21,456 KB
testcase_13 AC 60 ms
21,364 KB
testcase_14 AC 60 ms
21,272 KB
testcase_15 AC 60 ms
21,304 KB
testcase_16 AC 60 ms
21,496 KB
testcase_17 AC 61 ms
21,540 KB
testcase_18 AC 61 ms
19,660 KB
testcase_19 AC 60 ms
21,328 KB
testcase_20 AC 61 ms
23,404 KB
testcase_21 AC 61 ms
23,468 KB
testcase_22 AC 60 ms
21,636 KB
testcase_23 AC 60 ms
23,364 KB
testcase_24 AC 61 ms
23,380 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()
    {
        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);
    }
}
0