結果

問題 No.178 美しいWhitespace (1)
ユーザー pirorirori_n712pirorirori_n712
提出日時 2018-09-20 01:43:30
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 2,869 ms
コンパイル使用メモリ 104,656 KB
実行使用メモリ 23,880 KB
最終ジャッジ日時 2023-09-25 10:21:52
合計ジャッジ時間 4,848 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,788 KB
testcase_01 AC 61 ms
21,820 KB
testcase_02 AC 62 ms
21,860 KB
testcase_03 AC 62 ms
21,784 KB
testcase_04 AC 65 ms
23,832 KB
testcase_05 AC 65 ms
21,828 KB
testcase_06 AC 64 ms
23,880 KB
testcase_07 AC 62 ms
23,868 KB
testcase_08 AC 64 ms
23,764 KB
testcase_09 AC 63 ms
19,800 KB
testcase_10 AC 63 ms
23,812 KB
testcase_11 AC 62 ms
21,932 KB
testcase_12 AC 62 ms
21,904 KB
testcase_13 AC 64 ms
21,892 KB
testcase_14 AC 64 ms
21,860 KB
testcase_15 AC 64 ms
21,904 KB
testcase_16 AC 63 ms
21,764 KB
testcase_17 AC 62 ms
21,844 KB
testcase_18 AC 61 ms
21,872 KB
testcase_19 AC 63 ms
21,824 KB
testcase_20 AC 62 ms
23,868 KB
testcase_21 AC 63 ms
23,880 KB
testcase_22 AC 62 ms
23,872 KB
testcase_23 AC 64 ms
21,896 KB
testcase_24 AC 64 ms
23,812 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){
                count+=(l-max)*i;
                max=l;
            }
            count+=max-l;
        }
        Console.WriteLine(count>0?count/2:count);
    }
}
0