結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2015-06-11 12:11:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 43 ms / 5,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 879 ms |
コンパイル使用メモリ | 69,060 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-03 06:01:28 |
合計ジャッジ時間 | 1,896 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> using namespace std; typedef long long LL; int main(){ LL N; cin >> N; vector<LL> point(N); for(int i = 0; i < N; i++){ cin >> point[i]; } sort(point.begin(), point.end()); LL ans = 1e+9; for(int i = 1; i < point.size(); i++){ if(point[i] - point[i-1] > 0){ ans = min(ans, point[i] - point[i-1]); } } if(ans == 1e+9) ans = 0; cout << ans << endl; return 0; }