結果
問題 |
No.1285 ゴミ捨て
|
ユーザー |
|
提出日時 | 2025-09-10 15:28:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 410 bytes |
コンパイル時間 | 3,158 ms |
コンパイル使用メモリ | 281,508 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-09-10 15:29:03 |
合計ジャッジ時間 | 5,738 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); for (int i = 0; i + 1 < n; i++) if (a[i] + 1 >= a[i + 1]) { cout << 2 << "\n"; return 0; } cout << 1 << "\n"; }