結果
| 問題 | 
                            No.1285 ゴミ捨て
                             | 
                    
| コンテスト | |
| ユーザー | 
                             kekenx
                         | 
                    
| 提出日時 | 2022-11-18 10:03:39 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 302 bytes | 
| コンパイル時間 | 2,028 ms | 
| コンパイル使用メモリ | 196,440 KB | 
| 最終ジャッジ日時 | 2025-02-08 21:03:02 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 12 WA * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (auto& a_ : a) {
    cin >> a_;
  }
  sort(a.begin(), a.end());
  int ans = 1;
  for (int i = 1; i < n; i++) {
    if (a[i - 1] + 1 >= a[i])
      ans++;
  }
  cout << ans << '\n';
  return 0;
}
            
            
            
        
            
kekenx