結果

問題 No.1285 ゴミ捨て
ユーザー queeequeee
提出日時 2020-11-13 21:26:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 49 ms / 2,000 ms
コード長 2,272 bytes
コンパイル時間 956 ms
コンパイル使用メモリ 100,356 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-06 14:24:38
合計ジャッジ時間 2,411 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,948 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 47 ms
6,940 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 20 ms
6,940 KB
testcase_10 AC 41 ms
6,940 KB
testcase_11 AC 37 ms
6,940 KB
testcase_12 AC 28 ms
6,944 KB
testcase_13 AC 28 ms
6,940 KB
testcase_14 AC 44 ms
6,948 KB
testcase_15 AC 32 ms
6,940 KB
testcase_16 AC 10 ms
6,944 KB
testcase_17 AC 10 ms
6,940 KB
testcase_18 AC 9 ms
6,944 KB
testcase_19 AC 19 ms
6,940 KB
testcase_20 AC 9 ms
6,944 KB
testcase_21 AC 13 ms
6,944 KB
testcase_22 AC 49 ms
6,944 KB
testcase_23 AC 48 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//g++ t.cpp -o t && t < p.txt
//d>p.txt&&t<p.txt&&t2<p.txt

#include <iostream> // プログラムの耳と口
#include <vector> // 超有能配列秘書
#include <algorithm> // みんな大好きソートと二分探索
#include <queue> // きゅーちゃん、だいすき
#include <string> // to_string
#include <functional> // 関数を変数に入れる子
#include <set> // 値の取得・挿入・削除を高速に
#include <map> // setの妹 これまた優秀
#include <random> // 乱択さん
#include <ctime> // へびになりたい
#include <bitset> // へびになった シャー
#include <cassert>

// #include <atcoder/all>
// using namespace atcoder; // コンパイル重い
// g++ t.cpp -o t -I .

#define DB cerr<<"D"<<endl

using namespace std; using ll=long long; using ld=long double; const int INF=1e9; const ll LINF=1e18; const double dINF = 1e18; const ld ldINF = 1e18; const double EPS = 1e-6;
using P=pair<ll,ll>;
const ll M = 1000000007;
ll mod_pow(ll x, ll a) { ll an = 1; while(a > 0) { if (a&1) an = an * x % M; x = x * x % M; a >>= 1;} return an;}
ll mod_pow(ll x, ll a, ll m) { ll an = 1; while(a > 0) { if (a&1) an = an * x % m; x = x * x % m; a >>= 1;} return an;}
void add(ll& x, ll y) {x+=y; x%=M;}; void mul(ll& x, ll y) {x*=y; x%=M;}; template<typename T, typename U> void chmax(T& x, U y) {if (x<y) x=y;}; template<typename T, typename U> void chmin(T& x, U y) {if (x>y) x=y;} bool vaild(int x, int y, int hh, int ww){return 0<=x&&x<hh&&0<=y&&y<ww;}
ll gcd(ll a, ll b) {if (b==0) return a; else return gcd(b, a%b);}
int keta(ll a) {int res=0; while(a>0) res+=a%10, a/=10; return res;}
const int up[]={1,-1,0,0}, lf[]={0,0,1,-1};

ll n,x,an=0;
ll a[50], b[50], c[50], u[50];
void dfs(ll p, int id) {
  if (id == 0) {
    
  }
  dfs(p+a[id]*b[id],id+1);
  dfs(p+a[id]*(b[id]+1),id+1);
}

int main() {
  int n; cin>>n;
  ll a[n]; for(int i=0;i<n;i++) cin>>a[i];
  sort(a,a+n);
  for(int i=0;i<n-1;i++) {
    if (a[i] == a[i+1] - 1) {
      cout<<2<<endl;
      return 0;
    }
  }
  cout<<1<<endl;
}

// ・配列の大きさok? ・priority_queueはgreater? ・debug消した?
// ・落ち着いて。提出まで4分待ってね……WJ……1/10……2/10……

// Thank you for making problems and running the contest
0