結果

問題 No.178 美しいWhitespace (1)
ユーザー pirorirori_n712pirorirori_n712
提出日時 2018-09-20 01:39:09
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 678 bytes
コンパイル時間 2,325 ms
コンパイル使用メモリ 106,948 KB
実行使用メモリ 25,936 KB
最終ジャッジ日時 2023-09-25 10:21:17
合計ジャッジ時間 4,963 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 62 ms
21,856 KB
testcase_02 AC 62 ms
21,836 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 62 ms
23,924 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 61 ms
21,860 KB
testcase_12 AC 62 ms
21,892 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 61 ms
21,828 KB
testcase_19 WA -
testcase_20 AC 61 ms
19,920 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 62 ms
21,864 KB
testcase_24 AC 62 ms
21,848 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.Linq;

class No178{
    static void Main(){
        long max=0;
        long count=0;
        var isEvenNum=false;
        var num=Int32.Parse(Console.ReadLine());
        for(int i=0;i<num;++i){
            var line=Console.ReadLine().Split(' ').Select(x=>Int64.Parse(x)).ToArray();
            var l=line[0]+line[1]*4;
            if(i!=0&&((l%2==0)!=isEvenNum)){
                count=-1;
                break;
            }
            else isEvenNum=l%2==0;
            if(l>max){
                max=l;
                count+=(l-max)*i;
            }
            count+=l-max;
        }
        Console.WriteLine(count>0?count/2:count);
    }
}
0