結果

問題 No.1285 ゴミ捨て
ユーザー harurun
提出日時 2020-11-13 21:31:49
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 45 ms / 2,000 ms
コード長 346 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 65,132 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-28 21:43:18
合計ジャッジ時間 2,002 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  for(int i=0;i<N;i++)cin>>A.at(i);
  sort(A.begin(),A.end());
  for(int i=0;i<N-1;i++){
    if(A.at(i)+1==A.at(i+1)){
      printf("2\n");
      return 0;
    }
  }
  printf("1\n");
  return 0;
}
0