結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-14 14:28:51 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 40 ms / 5,000 ms |
| コード長 | 428 bytes |
| コンパイル時間 | 1,342 ms |
| コンパイル使用メモリ | 162,788 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-28 11:43:12 |
| 合計ジャッジ時間 | 2,790 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,in;
vector<int> x;
cin >> N;
while(cin >> in) x.push_back(in);
sort(x.begin(),x.end());
int ans=numeric_limits<int>::max();
for(int i=0;i<x.size()-1;i++){
if(ans>(x[i+1]-x[i]) && (x[i+1]-x[i])!=0) ans=x[i+1]-x[i];
}
if(ans!=numeric_limits<int>::max()) cout << ans << endl;
else cout << 0 << endl;
return 0;
}