結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
|
提出日時 | 2017-10-09 02:31:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 65 ms / 5,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 1,231 ms |
コンパイル使用メモリ | 163,052 KB |
実行使用メモリ | 8,192 KB |
最終ジャッジ日時 | 2024-11-17 05:52:39 |
合計ジャッジ時間 | 2,320 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(void) { int n; cin >> n; set<int> st; for (int i = 0; i < n; i++) { int x; cin >> x; st.insert(x); } int ans = 1e7, pre = -1; for (auto i : st) { if (pre != -1) { ans = min(ans, i - pre); } pre = i; } cout << (ans == 1e7 ? 0 : ans) << endl; return 0; }