結果
| 問題 | No.185 和風 | 
| コンテスト | |
| ユーザー |  soi09476291 | 
| 提出日時 | 2019-11-22 10:04:02 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,466 bytes | 
| コンパイル時間 | 1,102 ms | 
| コンパイル使用メモリ | 103,936 KB | 
| 実行使用メモリ | 18,304 KB | 
| 最終ジャッジ日時 | 2024-10-11 02:31:37 | 
| 合計ジャッジ時間 | 1,517 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 WA * 1 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Text;
using System.Linq;
namespace ConsoleApp11
{
    class Program
    {
        static void Main(string[] args)
        {
            long N = long.Parse(Console.ReadLine());
            long[] X = new long[N];
            long[] Y = new long[N];
            int tof = -1;
            for(long i = 0; i < N; i++)
            {
                var input = Console.ReadLine().Trim().Split(' ');
                X[i] = long.Parse(input[0]);
                Y[i] = long.Parse(input[1]);
            }
            for(long i = 0; i < N - 1; i++)
            {
                if(N > 1)
                {
                    if ((Y[i] - X[i]) == Y[i + 1] - X[i + 1] && (Y[i] - X[i]) >= 0)
                    {
                        tof = 1;
                    }
                    else
                    {
                        tof = -1;
                        break;
                    }
                }
                else
                {
                    if(Y[i] - X[i] >= 0)
                    {
                        tof = 1;
                    }
                    else
                    {
                        tof = -1;
                    }
                }
            }
            if(tof == 1)
            {
                Console.WriteLine(Y[0] - X[0]);
            }
            else if(tof == -1)
            {
                Console.WriteLine(tof);
            }
        }        
    }
}
            
            
            
        