結果

問題 No.135 とりあえず1次元の問題
ユーザー RCCWRCCW
提出日時 2017-02-04 18:54:07
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 482 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 150,648 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 00:48:51
合計ジャッジ時間 2,515 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,384 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 36 ms
4,376 KB
testcase_22 AC 39 ms
4,376 KB
evil01.txt AC 37 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

long long a,minv=1000003;
int main(void){
    cin>>a;
	vector<long long> l;
long long c;
	for (int i = 0; i < a; ++i) {
		cin>>c;
		l.push_back(c);
	}
	sort(l.begin(),l.end());
	l.erase(unique(l.begin(), l.end()), l.end());
    l.size();
/*    for (int i = 0; i < l.size(); ++i) {
		cout<<l[i]<<endl;
	}*/

	for (int i = 0; i < l.size()-1; ++i) {
		minv=min(abs(l[i+1]-l[i]),minv);
	}
	if(l.size()==1){minv=0;};
	cout<<minv<<endl;


}
0