結果

問題 No.1285 ゴミ捨て
ユーザー ninoinui
提出日時 2020-11-14 05:27:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 3,110 ms
コンパイル使用メモリ 197,512 KB
最終ジャッジ日時 2025-01-16 00:28:51
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

template <typename T, typename U> bool cmin(T &a, U b) { return a > b && (a = b, true); }
template <typename T, typename U> bool cmax(T &a, U b) { return a < b && (a = b, true); }

signed main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  for (int i = 0; i + 1 < N; i++) {
    if (A.at(i) + 1 < A.at(i + 1)) continue;
    return cout << 2 << "\n", 0;
  }
  cout << 1 << "\n";
}
0