結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー | Zu_rin |
提出日時 | 2019-04-05 15:34:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 20 ms / 5,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 571 ms |
コンパイル使用メモリ | 75,092 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-11 17:30:08 |
合計ジャッジ時間 | 1,864 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #define INF 1 << 20 using namespace std; int main(void) { int num, i = 0, ans = INF, buf; cin >> num; vector<int>data(num); for (; i < num; i++) scanf("%d", &data[i]); sort(data.begin(), data.end()); i = num - 1; while (i > 0) { buf = data[i--] - data[i]; if (buf != 0) ans = min(ans, buf); } if (ans == INF) ans = 0; cout << ans << "\n"; return 0; }