結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
|
提出日時 | 2015-04-04 15:40:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 18 ms / 5,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 2,044 ms |
コンパイル使用メモリ | 163,208 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2025-01-03 05:32:16 |
合計ジャッジ時間 | 2,477 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; bool solve(){ int n; cin >> n; vector<int> a(n); for(auto &x : a) cin >> x; sort(begin(a), end(a)); a.erase(unique(begin(a), end(a)), end(a)); adjacent_difference(begin(a), end(a), begin(a)); cout << (a.size() == 1 ? 0 : *min_element(next(begin(a)), end(a))) << endl; return true; } signed main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << std::fixed << std::setprecision(10); solve(); return 0; } // vim:set foldmethod=marker commentstring=//%s: