結果

問題 No.406 鴨等間隔の法則
ユーザー RinRin
提出日時 2016-09-09 10:41:31
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 735 bytes
コンパイル時間 3,091 ms
コンパイル使用メモリ 77,684 KB
実行使用メモリ 50,564 KB
最終ジャッジ日時 2024-04-24 20:56:08
合計ジャッジ時間 16,846 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 393 ms
48,036 KB
testcase_01 AC 109 ms
40,112 KB
testcase_02 AC 109 ms
41,520 KB
testcase_03 AC 110 ms
39,944 KB
testcase_04 AC 552 ms
48,368 KB
testcase_05 AC 382 ms
47,028 KB
testcase_06 AC 374 ms
48,180 KB
testcase_07 AC 436 ms
48,024 KB
testcase_08 AC 538 ms
48,308 KB
testcase_09 AC 564 ms
48,336 KB
testcase_10 AC 401 ms
48,012 KB
testcase_11 AC 510 ms
48,332 KB
testcase_12 AC 465 ms
48,012 KB
testcase_13 AC 449 ms
48,224 KB
testcase_14 WA -
testcase_15 AC 202 ms
45,716 KB
testcase_16 AC 212 ms
45,832 KB
testcase_17 AC 189 ms
44,488 KB
testcase_18 AC 228 ms
46,312 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 254 ms
47,312 KB
testcase_22 WA -
testcase_23 AC 462 ms
48,420 KB
testcase_24 WA -
testcase_25 AC 539 ms
48,416 KB
testcase_26 WA -
testcase_27 AC 502 ms
48,648 KB
testcase_28 AC 446 ms
48,292 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 541 ms
48,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class b {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int foo[] = new int[N];
		int min = 114514810;
		int min2th = 364364893;
		for(int i = 0; i < N; i++){
			foo[i] = sc.nextInt();
			if(foo[i] < min){
				min2th = min;
				min = foo[i];
			}else if(foo[i] < min2th){
				min2th = foo[i];
			}
		}
		for(int i = 1; i < N; i++){
			if(foo[i] < foo[i - 1]){
				int tmp = foo[i];
				foo[i] = foo[i - 1];
				foo[i - 1] = tmp;
			}
		}
		int bar = min2th - min;
		for(int i = 0; i < N - 1; i++){
			if(foo[i] + bar != foo[i + 1] || foo[i] == foo[i + 1]){
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}
0