結果

問題 No.2126 MEX Game
ユーザー simansiman
提出日時 2022-11-20 07:14:58
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 327 bytes
コンパイル時間 600 ms
コンパイル使用メモリ 11,832 KB
実行使用メモリ 27,452 KB
最終ジャッジ日時 2023-10-21 08:20:06
合計ジャッジ時間 6,024 ms
ジャッジサーバーID
(参考情報)
judge13 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
16,100 KB
testcase_01 AC 81 ms
16,100 KB
testcase_02 AC 79 ms
16,100 KB
testcase_03 AC 77 ms
16,100 KB
testcase_04 AC 78 ms
16,100 KB
testcase_05 AC 77 ms
16,100 KB
testcase_06 AC 79 ms
16,100 KB
testcase_07 WA -
testcase_08 AC 75 ms
16,100 KB
testcase_09 AC 78 ms
16,100 KB
testcase_10 AC 135 ms
24,960 KB
testcase_11 AC 136 ms
24,960 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 131 ms
24,968 KB
testcase_15 AC 120 ms
24,968 KB
testcase_16 AC 118 ms
24,860 KB
testcase_17 AC 121 ms
22,340 KB
testcase_18 AC 120 ms
22,492 KB
testcase_19 AC 119 ms
22,184 KB
testcase_20 AC 121 ms
22,184 KB
testcase_21 AC 133 ms
27,452 KB
testcase_22 AC 77 ms
16,100 KB
testcase_23 AC 76 ms
16,100 KB
testcase_24 AC 76 ms
16,100 KB
testcase_25 AC 78 ms
16,100 KB
testcase_26 WA -
testcase_27 AC 84 ms
16,100 KB
testcase_28 AC 76 ms
16,100 KB
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)
C = A.tally
C.default = 0

ans = 0

0.upto(A.max) do |a|
  has_three = true if C[a] >= 3

  if C[a] <= 1
    if C[a] == 1
      if has_three
        ans += 1
      elsif (a + 1..A.max).any? { |x| C[x] >= 1 }
        ans += 1
      end
    end

    break
  end

  ans += 1
end

puts ans
0