結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
koukonko
|
| 提出日時 | 2015-12-12 15:06:51 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 633 bytes |
| コンパイル時間 | 2,796 ms |
| コンパイル使用メモリ | 76,148 KB |
| 実行使用メモリ | 100,020 KB |
| 最終ジャッジ日時 | 2025-01-03 10:55:31 |
| 合計ジャッジ時間 | 33,046 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 TLE * 3 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
try {
Scanner scan = new Scanner(System.in);
int N = scan.nextInt();
int[] x = new int[N];
int ans = Integer.MAX_VALUE;
x[0] = scan.nextInt();
for (int i = 1; i < N; ++i) {
x[i] = scan.nextInt();
for (int j = i - 1; j > 0; --j) {
if (x[i] != x[j]) {
if (ans > Math.abs(x[i] - x[j])) {
ans = Math.abs(x[i] - x[j]);
}
}
}
}
if(ans == Integer.MAX_VALUE){
ans = 0;
}
System.out.println(ans);
scan.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
koukonko