結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-22 23:52:44 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 24 ms / 5,000 ms |
| + 865µs | |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 338 ms |
| コンパイル使用メモリ | 78,124 KB |
| 実行使用メモリ | 9,860 KB |
| 最終ジャッジ日時 | 2026-10-11 11:21:13 |
| 合計ジャッジ時間 | 2,010 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int n, x[100000];
cin >> n;
for(int i=0; i<n; i++) cin >> x[i];
sort(x, x+n);
int ans = 1000010;
for(int i=0; i<n-1; i++){
if(x[i+1] == x[i]) continue;
ans = min(ans, x[i+1] - x[i]);
}
cout << (ans == 1000010 ? 0 : ans) << endl;
return 0;
}