結果
問題 | No.135 とりあえず1次元の問題 |
ユーザー |
|
提出日時 | 2025-06-27 05:02:41 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 45 ms / 5,000 ms |
コード長 | 821 bytes |
コンパイル時間 | 2,957 ms |
コンパイル使用メモリ | 281,320 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-06-27 05:02:46 |
合計ジャッジ時間 | 4,299 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
// 実験:int 型でやってバグるパターンはあるのか? #include <bits/stdc++.h> using namespace std; /////////////////// メイン /////////////////// int main () { //////////////////// 入力 //////////////////// int n; cin >> n; vector<int> a(n); for (int i=0; i<n; i++) { cin >> a.at(i); } //////////////// 出力変数定義 //////////////// int result = 2e9; //////////////////// 処理 //////////////////// sort(a.begin(),a.end()); if (a.front()==a.back()) { result = 0; } else { for (int i=0; i<n-1; i++) { if (a.at(i)==a.at(i+1)) continue; result = min(result,a.at(i+1)-a.at(i)); } } //////////////////// 出力 //////////////////// cout << result << endl; //////////////////// 終了 //////////////////// return 0; }