結果

問題 No.1053 ゲーミング棒
ユーザー maimai
提出日時 2020-05-15 21:35:24
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 11,876 KB
実行使用メモリ 23,312 KB
最終ジャッジ日時 2023-10-19 13:10:58
合計ジャッジ時間 5,672 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
16,064 KB
testcase_01 AC 88 ms
16,064 KB
testcase_02 AC 89 ms
16,064 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 89 ms
16,064 KB
testcase_06 AC 88 ms
16,064 KB
testcase_07 AC 88 ms
16,064 KB
testcase_08 AC 87 ms
16,064 KB
testcase_09 AC 87 ms
16,064 KB
testcase_10 AC 87 ms
16,064 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 86 ms
16,064 KB
testcase_14 AC 88 ms
16,064 KB
testcase_15 AC 87 ms
16,064 KB
testcase_16 AC 86 ms
16,064 KB
testcase_17 AC 89 ms
16,064 KB
testcase_18 AC 88 ms
16,064 KB
testcase_19 AC 88 ms
16,064 KB
testcase_20 AC 86 ms
16,064 KB
testcase_21 AC 86 ms
16,064 KB
testcase_22 AC 86 ms
16,064 KB
testcase_23 AC 144 ms
23,312 KB
testcase_24 AC 143 ms
23,312 KB
testcase_25 AC 144 ms
23,312 KB
testcase_26 WA -
testcase_27 AC 86 ms
16,064 KB
testcase_28 AC 88 ms
16,064 KB
testcase_29 AC 86 ms
16,064 KB
testcase_30 AC 136 ms
22,932 KB
testcase_31 AC 136 ms
22,932 KB
testcase_32 AC 136 ms
22,932 KB
testcase_33 AC 135 ms
22,932 KB
testcase_34 AC 132 ms
22,932 KB
testcase_35 AC 136 ms
23,104 KB
testcase_36 AC 137 ms
23,128 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def lscan; gets.split.map(&:to_i); end
def bye(msg); puts msg.to_s; exit; end
n = gets.to_i
a = [nil]*n
q = nil
warn = false
lscan.each do |v|
  v -= 1
  next if v == q
  q = v
  if a[v]
    bye '-1' if warn
    warn = true
  end
  a[v] = true
end
if warn
  p 1
else
  p 0
end
0