結果

問題 No.135 とりあえず1次元の問題
ユーザー HaarHaar
提出日時 2016-04-15 02:28:09
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 411 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 58,788 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2023-09-02 00:22:49
合計ジャッジ時間 1,750 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
6,668 KB
testcase_01 AC 5 ms
6,756 KB
testcase_02 AC 5 ms
6,788 KB
testcase_03 WA -
testcase_04 AC 5 ms
6,768 KB
testcase_05 AC 4 ms
6,836 KB
testcase_06 AC 6 ms
6,904 KB
testcase_07 AC 5 ms
6,704 KB
testcase_08 AC 5 ms
6,776 KB
testcase_09 AC 5 ms
6,944 KB
testcase_10 AC 5 ms
6,884 KB
testcase_11 AC 5 ms
6,816 KB
testcase_12 AC 4 ms
6,712 KB
testcase_13 AC 6 ms
6,844 KB
testcase_14 AC 5 ms
6,820 KB
testcase_15 AC 5 ms
6,884 KB
testcase_16 AC 5 ms
6,712 KB
testcase_17 AC 5 ms
6,720 KB
testcase_18 AC 5 ms
6,880 KB
testcase_19 AC 6 ms
6,668 KB
testcase_20 AC 5 ms
6,772 KB
testcase_21 AC 35 ms
6,720 KB
testcase_22 AC 35 ms
6,700 KB
evil01.txt AC 35 ms
6,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
	int n, x, min, temp;
	vector< int > table(1000001, 0);
	
	cin >> n;
	for(int i=0;i<n;++i){
		cin >> x;
		table[x] = 1;
	}
	
	temp = -1;
	min = -1;
	for(int i=0;i<=1000000;++i){
		if(table[i]){
			if(temp != -1){
				if(min == -1 || min > i - temp){
					min = i - temp;
				}
			}
			temp = i;
		}
	}
	cout << min << endl;
	
	return 0;
}
0