結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー | spacia |
提出日時 | 2015-12-29 15:24:05 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 757 bytes |
コンパイル時間 | 3,051 ms |
コンパイル使用メモリ | 73,620 KB |
実行使用メモリ | 70,812 KB |
最終ジャッジ日時 | 2023-09-01 23:02:55 |
合計ジャッジ時間 | 15,000 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
evil01.txt | -- | - |
ソースコード
import java.io.*; import java.util.*; import java.math.*; class Main135 { public static void out (Object out) { System.out.println(out); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int ans = Integer.MAX_VALUE; int n = Integer.parseInt(br.readLine()); String[] line = br.readLine().split(" "); ArrayList<Integer> list = new ArrayList<Integer>(); for (int i = 0; i < n; i++) { int m = Integer.parseInt(line[i]); if (!list.contains(m)) list.add(m); } Collections.sort(list); for (int i = 1; i < list.size(); i++) { ans = Math.min(ans , list.get(i) - list.get(i - 1)); } out(list.size() == 1 ? 0 : ans); } }