結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー | focus |
提出日時 | 2018-01-23 22:24:01 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 42 ms / 5,000 ms |
コード長 | 503 bytes |
コンパイル時間 | 1,194 ms |
コンパイル使用メモリ | 64,716 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 03:48:42 |
合計ジャッジ時間 | 1,841 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<cstdio> using namespace std; int main(){ vector<long long> vc; long long N,x,m=10000000; bool flag=0; cin >> N; while(N--){ cin >> x; vc.push_back(x); } sort(vc.begin(),vc.end()); for(long long i=1;i<vc.size();i++){ if((vc[i]-vc[i-1])){ flag=1; m = min(m,(vc[i]-vc[i-1])); } } if(flag) cout << m; else cout << '0'; return 0; }