結果

問題 No.1285 ゴミ捨て
ユーザー mesame3993mesame3993
提出日時 2021-11-18 01:34:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 257 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 86,596 KB
実行使用メモリ 78,608 KB
最終ジャッジ日時 2023-08-25 23:38:38
合計ジャッジ時間 4,236 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,080 KB
testcase_01 AC 70 ms
71,236 KB
testcase_02 AC 73 ms
71,048 KB
testcase_03 AC 70 ms
71,252 KB
testcase_04 AC 71 ms
71,140 KB
testcase_05 AC 70 ms
71,252 KB
testcase_06 AC 71 ms
71,008 KB
testcase_07 AC 147 ms
78,344 KB
testcase_08 AC 93 ms
76,868 KB
testcase_09 AC 114 ms
77,632 KB
testcase_10 AC 135 ms
78,308 KB
testcase_11 AC 133 ms
78,576 KB
testcase_12 AC 123 ms
77,748 KB
testcase_13 AC 123 ms
77,700 KB
testcase_14 AC 141 ms
78,292 KB
testcase_15 AC 127 ms
77,916 KB
testcase_16 AC 103 ms
77,516 KB
testcase_17 AC 103 ms
77,240 KB
testcase_18 AC 103 ms
77,124 KB
testcase_19 AC 112 ms
77,500 KB
testcase_20 AC 108 ms
77,208 KB
testcase_21 AC 105 ms
77,400 KB
testcase_22 AC 144 ms
78,608 KB
testcase_23 AC 143 ms
78,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
cnt0, cnt1 = 0, 0
A = [int(input()) for _ in range(n)]
A.sort()
for a in A:
  if a % 2 == 0:
    cnt1 += 1
  else:
    cnt0 += 1
for i in range(n-1):
  if A[i+1] - A[i] <= 1:
    if cnt0 and cnt1:
      print(2)
      break
else:
  print(1)
0