結果
| 問題 |
No.1285 ゴミ捨て
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-16 10:01:24 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 488 bytes |
| コンパイル時間 | 2,217 ms |
| コンパイル使用メモリ | 197,712 KB |
| 最終ジャッジ日時 | 2025-01-16 01:05:11 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 WA * 10 |
ソースコード
#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 ans = 1;
ll pre = a[0];
for(int i = 1; i < n; i++){
if(pre + 1 < a[i]){
pre = a[i];
}else{
pre = a[i];
ans++;
}
}
cout << ans << endl;
return 0;
}