結果
問題 | No.1285 ゴミ捨て |
ユーザー |
|
提出日時 | 2020-11-13 21:37:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 502 bytes |
コンパイル時間 | 1,708 ms |
コンパイル使用メモリ | 170,064 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-28 21:44:43 |
合計ジャッジ時間 | 2,689 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#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);if(n==1) cout<<1<<endl;else{int flag=1;rep(i,0,n-1) if(a[i]+1==a[i+1]) flag=0;if(flag) cout<<1<<endl;else cout<<2<<endl;}}int32_t main(){ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);solve();}