結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
spacia
|
| 提出日時 | 2015-12-29 15:24:05 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 757 bytes |
| コンパイル時間 | 2,541 ms |
| コンパイル使用メモリ | 78,240 KB |
| 実行使用メモリ | 90,596 KB |
| 最終ジャッジ日時 | 2025-01-03 11:05:46 |
| 合計ジャッジ時間 | 29,380 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 TLE * 3 |
ソースコード
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);
}
}
spacia