結果

問題 No.185 和風
コンテスト
ユーザー aaa aa
提出日時 2025-12-09 21:50:48
言語 C#
(.NET 8.0.404)
結果
MLE  
実行時間 -
コード長 675 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 7,600 ms
コンパイル使用メモリ 170,792 KB
実行使用メモリ 188,980 KB
最終ジャッジ日時 2025-12-09 21:50:57
合計ジャッジ時間 8,849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (105 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #
raw source code

using System;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        int answer = int.MinValue;

        for (int i = 0; i < N; i++)
        {
            var parts = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int x = parts[1] - parts[0];

            if (x <= 0)
            {
                Console.WriteLine(-1);
                return;
            }

            if (answer == int.MinValue)
                answer = x;
            else if (answer != x)
            {
                Console.WriteLine(-1);
                return;
            }
        }

        Console.WriteLine(answer);
    }
}
0