結果

問題 No.742 にゃんにゃんにゃん 猫の挨拶
ユーザー manhattanermanhattaner
提出日時 2018-11-02 20:52:24
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 603 bytes
コンパイル時間 456 ms
コンパイル使用メモリ 7,168 KB
実行使用メモリ 19,740 KB
最終ジャッジ日時 2024-04-30 17:29:55
合計ジャッジ時間 5,914 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 90 ms
12,160 KB
testcase_02 WA -
testcase_03 AC 89 ms
12,160 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 89 ms
12,288 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
Goal = ([0]*N).map{ gets.to_i }

greeting_count = 0

for i in 0...Goal.size do
    myPos = i + 1
    myGoal = Goal[i]
    for j in (i+1)...Goal.size do
        otherPos = j + 1
        if (myPos <= Goal[j] &&  Goal[j] <= myGoal) || (Goal[j] <= myGoal && myGoal <= otherPos) then
            #puts "Greet myPos: #{myPos}, otherPos: #{otherPos}, Goal[#{j}]: #{Goal[j]}, myGoal: #{myGoal}"
            greeting_count += 1
        else
            #puts "not Greet myPos: #{myPos}, otherPos: #{otherPos}, Goal[#{j}]: #{Goal[j]}, myGoal: #{myGoal}"
        end
    end
end

puts greeting_count
0