結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
ふう
|
| 提出日時 | 2015-01-25 23:26:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 44 ms / 5,000 ms |
| コード長 | 616 bytes |
| コンパイル時間 | 961 ms |
| コンパイル使用メモリ | 88,084 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-03 03:02:32 |
| 合計ジャッジ時間 | 1,881 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 22 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <map>
#include <list>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <iomanip>
using namespace std;
int main(void)
{
int n;
int res = 10000000;
int x[100000];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i];
}
sort(x, x + n);
for (int i = 0; i < n; i++) {
if (x[i] != x[i + 1]) {
res = min(abs(x[i + 1] - x[i]), res);
}
}
if (res == 10000000) res = 0;
cout << res << endl;
return (0);
}
ふう