結果
問題 |
No.716 距離
|
ユーザー |
![]() |
提出日時 | 2022-07-11 15:17:40 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 305 bytes |
コンパイル時間 | 4,324 ms |
コンパイル使用メモリ | 250,384 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-13 04:38:34 |
合計ジャッジ時間 | 5,023 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 40 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long signed main(){ int N; cin>>N; int ans = 1e15; vector<int> S(N); for(int i=0;i<N;i++) cin>>S[i]; sort(S.begin(),S.end()); for(int i=1;i<N;i++) ans = min(ans,abs(S[i]-S[i-1])); cout<<ans<<endl; cout<<S[N-1]-S[0]<<endl; }