結果

問題 No.185 和風
ユーザー FVRChanFVRChan
提出日時 2017-10-03 09:15:18
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 2,197 ms
コンパイル使用メモリ 75,208 KB
実行使用メモリ 56,732 KB
最終ジャッジ日時 2024-04-27 22:33:09
合計ジャッジ時間 3,819 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
53,980 KB
testcase_01 AC 194 ms
56,732 KB
testcase_02 AC 186 ms
56,500 KB
testcase_03 AC 183 ms
56,468 KB
testcase_04 AC 181 ms
56,640 KB
testcase_05 WA -
testcase_06 AC 173 ms
56,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;
public class Main{
	private static Scanner sc=new Scanner(System.in);
	public static void main(String args[])throws Exception{
		int n=sc.nextInt(),are[]=new int[n];
		for(int i=0;i<n;i++){
			are[i]=-(sc.nextInt()-sc.nextInt());
		}Arrays.sort(are);
		int min=are[0];
		if(min<0)System.out.println(-1);
		else{
			for(int i=0;i<are.length;i++){
				if(min != are[i]){
					System.out.println(-1);
					return;
				}
			}System.out.println(min);
		}
	}
}
0