結果

問題 No.905 Sorted?
ユーザー Takuya NoguchiTakuya Noguchi
提出日時 2019-10-25 00:55:52
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 333 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 11,240 KB
実行使用メモリ 82,780 KB
最終ジャッジ日時 2023-09-25 11:53:20
合計ジャッジ時間 7,960 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
19,656 KB
testcase_01 AC 80 ms
15,132 KB
testcase_02 AC 82 ms
15,276 KB
testcase_03 AC 82 ms
15,192 KB
testcase_04 AC 83 ms
15,260 KB
testcase_05 AC 158 ms
19,836 KB
testcase_06 AC 100 ms
16,156 KB
testcase_07 AC 553 ms
33,816 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)

def increase?(diffs)
  diffs.all? { |diff| diff >= 0 }
end

def decrease?(diffs)
  diffs.all? { |diff| diff <= 0 }
end

gets.to_i.times do
  l, r = gets.split.map(&:to_i)
  diffs = A[l..r].each_cons(2).map { |a, b| b - a }
  puts "#{increase?(diffs) ? 1 : 0} #{decrease?(diffs) ? 1 : 0}"
end
0