結果
問題 | No.406 鴨等間隔の法則 |
ユーザー | Rin |
提出日時 | 2016-09-09 10:37:30 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 730 bytes |
コンパイル時間 | 4,398 ms |
コンパイル使用メモリ | 77,148 KB |
実行使用メモリ | 50,200 KB |
最終ジャッジ日時 | 2024-04-24 20:55:21 |
合計ジャッジ時間 | 20,616 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 475 ms
48,144 KB |
testcase_01 | AC | 132 ms
41,048 KB |
testcase_02 | AC | 132 ms
41,320 KB |
testcase_03 | AC | 136 ms
41,228 KB |
testcase_04 | AC | 643 ms
48,472 KB |
testcase_05 | AC | 460 ms
48,200 KB |
testcase_06 | AC | 493 ms
47,832 KB |
testcase_07 | AC | 466 ms
47,972 KB |
testcase_08 | AC | 653 ms
48,512 KB |
testcase_09 | AC | 549 ms
47,796 KB |
testcase_10 | AC | 470 ms
47,860 KB |
testcase_11 | AC | 594 ms
48,216 KB |
testcase_12 | AC | 506 ms
48,172 KB |
testcase_13 | AC | 539 ms
48,044 KB |
testcase_14 | WA | - |
testcase_15 | AC | 242 ms
45,684 KB |
testcase_16 | AC | 260 ms
45,860 KB |
testcase_17 | AC | 214 ms
44,472 KB |
testcase_18 | AC | 264 ms
46,036 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 310 ms
47,040 KB |
testcase_22 | WA | - |
testcase_23 | AC | 516 ms
48,008 KB |
testcase_24 | WA | - |
testcase_25 | AC | 665 ms
48,376 KB |
testcase_26 | WA | - |
testcase_27 | AC | 557 ms
48,188 KB |
testcase_28 | AC | 590 ms
48,196 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 681 ms
48,100 KB |
ソースコード
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]; for(int i = 0; i < N; i++) foo[i] = sc.nextInt(); int min = 114514810; int min2th = 364364893; for(int i = 1; i < N; i++){ if(foo[i] < min){ min2th = min; min = foo[i]; }else if(foo[i] < min2th){ min2th = foo[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"); } }