結果
| 問題 | 
                            No.1285 ゴミ捨て
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-11-16 21:58:57 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 54 ms / 2,000 ms | 
| コード長 | 455 bytes | 
| コンパイル時間 | 1,957 ms | 
| コンパイル使用メモリ | 197,612 KB | 
| 最終ジャッジ日時 | 2025-01-16 01:14:13 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 22 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;
int main() {
    int n; cin >> n;
    V<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(ALL(a));
    int cnt = 0;
    for(int i = 0; i < n - 1; i++){
        if(a[i] + 1 == a[i + 1]){
            cnt++;
        }
    }
    if(0 < cnt) cout << 2 << endl;
    else cout << 1 << endl;
    return 0;
}