結果

問題 No.1285 ゴミ捨て
ユーザー mesame3993mesame3993
提出日時 2021-11-18 01:29:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 491 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 80,384 KB
最終ジャッジ日時 2024-12-24 11:32:14
合計ジャッジ時間 3,183 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  readline=stdin.readline
  n = int(readline())
  cnt0, cnt1 = 0, 0
  A = []
  for i in range(n):
    a = int(readline())
    A.append(a)
    if a % 2 == 0:
      cnt1 += 1
    else:
      cnt0 += 1
  A.sort()
  flag = False
  for i in range(n-1):
    if A[i+1] - A[i] <= 1:
      flag = True
      break
  if flag:
    if cnt0==0 or cnt1==0:
      ans = 1
    else:
      ans = 2
  else:
    ans = 1
  print(ans)
main()
0