結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-05 05:37:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 535 bytes |
| コンパイル時間 | 4,619 ms |
| コンパイル使用メモリ | 231,768 KB |
| 実行使用メモリ | 10,792 KB |
| 最終ジャッジ日時 | 2024-12-21 17:47:31 |
| 合計ジャッジ時間 | 25,789 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 TLE * 3 |
ソースコード
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
int main() {
int N; cin >> N;
vector<int> X(0);
for(int i = 0; i < N; i++){
int x; cin >> x;
bool flag = true;
for(int j = 0; j < (int)X.size(); j++){
if(X[j] == x) flag = false;
}
if(flag) X.push_back(x);
}
sort(X.begin(), X.end());
if((int)X.size() >= 2){
int ans = 1000000000;
for(int i = 0; i < (int)X.size()-1; i++){
ans = min(ans, X[i+1]-X[i]);
}
cout << ans << endl;
}
else cout << 0 << endl;
}