結果

問題 No.185 和風
コンテスト
ユーザー りな
提出日時 2025-11-10 16:10:40
言語 C#
(.NET 8.0.404)
結果
MLE  
実行時間 -
コード長 953 bytes
コンパイル時間 8,134 ms
コンパイル使用メモリ 168,908 KB
実行使用メモリ 186,620 KB
最終ジャッジ日時 2025-11-10 16:10:50
合計ジャッジ時間 9,124 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 MLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (109 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int count = 0;
            int ans = 0;
            for (int i = 0; i < a; i++)
            {
                string[] s = Console.ReadLine().Split(' ');
                int b = int.Parse(s[0]);
                int c = int.Parse(s[1]);
                
                if (ans == c - b&&c-b!=0)
                {
                    count++;
                }
                if (i == 0)
                {
                    ans = c - b;
                    if (ans>=1)
                    {
                        count++;
                    }
                }
            }
            if (count == a)
            {
                Console.WriteLine(ans);
            }
            else
            {
                Console.WriteLine("-1");
            }
        }
    }
}
0