結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2021-09-10 10:21:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 87 ms / 5,000 ms |
コード長 | 418 bytes |
コンパイル時間 | 1,671 ms |
コンパイル使用メモリ | 164,388 KB |
実行使用メモリ | 8,064 KB |
最終ジャッジ日時 | 2025-01-02 17:29:40 |
合計ジャッジ時間 | 3,492 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; ll mod=1000000007; ll INF=1LL<<60; int main() { int N; cin >> N; set<int> X; for(int i=0;i<N;i++){ int A; cin >> A; X.insert(A); } int ans=1000000000;; for(auto it=X.begin();it!=prev(X.end());it++){ int A=(*it); int B=*next(it); ans=min(ans,B-A); } if(ans==1000000000){ cout << 0 << endl; return 0; } cout << ans << endl; }