結果
問題 |
No.1285 ゴミ捨て
|
ユーザー |
![]() |
提出日時 | 2021-02-08 18:35:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 435 bytes |
コンパイル時間 | 657 ms |
コンパイル使用メモリ | 75,720 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 20:17:37 |
合計ジャッジ時間 | 2,539 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 12 WA * 10 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long ll; int main(){ int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++){ cin >> a[i]; } sort(a.begin() , a.end()); a.push_back(-1); int ans = 0; for(int i = 0; i < n; i++){ if(a[i] + 1 < a[i + 1])continue; ans += 1; } cout << ans << endl; return 0; }