結果

問題 No.182 新規性の虜
コンテスト
ユーザー TatsuDX
提出日時 2016-09-09 00:17:38
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
WA  
実行時間 -
コード長 423 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,855 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 55,948 KB
最終ジャッジ日時 2026-05-11 00:28:37
合計ジャッジ時間 6,370 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2 RE * 1
other WA * 23 RE * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt(), a = sc.nextInt(), b = sc.nextInt(), d = b - a;
		if(d <= 0){
			System.out.println(-1);
			return;
		}
		for(int i = 1; i < n; i++){
			a = sc.nextInt();
			b = sc.nextInt();
			if(d != b-a){
				System.out.println(-1);
				return;
			}
		}
		System.out.println(d);
	}
}
0