結果

問題 No.135 とりあえず1次元の問題
ユーザー hum_ophum_op
提出日時 2015-01-28 22:17:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 485 bytes
コンパイル時間 439 ms
コンパイル使用メモリ 61,464 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-31 01:30:11
合計ジャッジ時間 6,656 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main(){
	int N;
	int X[100000];
	fill(X, X + 100000, 1000000);
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> X[i];
	}
	
	sort(X, X+N);
	for(int i = 0; i < N; i++){
		for(int j = i+1; j < 100000; j++){
			if(X[i] == X[j]){
				X[j] = 100000;
			}else {
				break;
			}
		}
	}
	sort(X, X + 10000);
	int a = X[2] - X[1], b = X[1] - X[0];
	if(a < b){
		cout << a << endl;
	}else {
		cout << b << endl;
	}
	
	return 0;
}
0