結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
cww
|
| 提出日時 | 2016-09-25 04:32:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 5,000 ms |
| コード長 | 503 bytes |
| コンパイル時間 | 1,459 ms |
| コンパイル使用メモリ | 172,244 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 06:58:20 |
| 合計ジャッジ時間 | 2,185 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
int main()
{
int N;
cin >> N;
vector<int> vc(N);
for( auto&& x : vc )
{
cin >> x;
}
sort( vc.begin(), vc.end() );
vector<int> res;
REP( i, N - 1 )
{
if( vc[ i + 1 ] - vc[ i ] != 0 )
{
res.push_back( abs( vc[ i + 1 ] - vc[ i ] ) );
}
}
cout << ( res.size() == 0 ? 0 :*min_element( res.begin(), res.end() ) ) << endl;
return 0;
}
cww