結果
問題 |
No.1285 ゴミ捨て
|
ユーザー |
|
提出日時 | 2020-11-13 21:24:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 456 bytes |
コンパイル時間 | 1,617 ms |
コンパイル使用メモリ | 170,628 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-22 20:25:41 |
合計ジャッジ時間 | 2,776 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 WA * 12 |
ソースコード
#include <bits/stdc++.h> #define ll long long #define rep(i,x,n) for(ll i=x;i<n;i++) #define rrep(i,x,n) for(ll i=x;i>=n;i--) using namespace std; ll mod=1000000007; void solve(){ int n; cin>>n; int a[n]; rep(i,0,n) cin>>a[i]; sort(a,a+n); int st=a[n-1]; int ans=1; rrep(i,n-2,0){ if(a[i]+1>=st) st=a[i],ans++; } cout<<ans<<endl; } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); solve(); }