結果
| 問題 | No.135 とりあえず1次元の問題 |
| コンテスト | |
| ユーザー |
Ysmr_Ry
|
| 提出日時 | 2015-01-29 00:25:59 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 14 ms / 5,000 ms |
| コード長 | 551 bytes |
| 記録 | |
| コンパイル時間 | 494 ms |
| コンパイル使用メモリ | 68,280 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-06 11:07:36 |
| 合計ジャッジ時間 | 1,557 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
// yukicoder 135 (http://yukicoder.me/problems/135)
#include<cstdio>
#include<algorithm>
#include<vector>
#define rep(i,a) for(int i=0;i<(a);++i)
#define all(a) (a).begin(), (a).end()
const int MAX_N = 100000;
int N;
std::vector<int> xs;
int main()
{
scanf( "%d", &N );
rep( i, N )
{
int X;
scanf( "%d", &X );
xs.push_back(X);
}
std::sort( all(xs) );
xs.erase( std::unique( all(xs) ), xs.end() );
int ans = 1<<30;
rep( i, xs.size()-1 )
ans = std::min( ans, abs(xs[i+1]-xs[i]) );
printf( "%d\n", ans==1<<30?0:ans );
return 0;
}
Ysmr_Ry