結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
![]() |
提出日時 | 2019-08-27 17:30:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 44 ms / 5,000 ms |
コード長 | 681 bytes |
コンパイル時間 | 1,111 ms |
コンパイル使用メモリ | 85,168 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 22:59:04 |
合計ジャッジ時間 | 2,221 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include<iostream> #include<algorithm> #include <vector> #include<cmath> #include<iomanip> using namespace std; typedef long long int lont; int main() { int N; cin >> N; if (N == 1) { cout << 0 << endl; } else { vector<int>veca(N); for (int ia = 0; ia < N; ia++) { cin >> veca.at(ia); } sort(veca.begin(), veca.end()); vector<int>vecb(N - 1); for (int ib = 0; ib < N - 1; ib++) { vecb.at(ib) = veca.at(ib + 1) - veca.at(ib); } sort(vecb.begin(), vecb.end()); int cnt = 0; for (int ic = 0; ic < N - 1; ic++) { if (vecb.at(ic) != 0) { cout << vecb.at(ic) << endl; cnt++; break; } } if (cnt == 0) { cout << 0 << endl; } } }