結果

問題 No.1020 Reverse
ユーザー simansiman
提出日時 2020-07-01 19:19:55
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 167 bytes
コンパイル時間 61 ms
コンパイル使用メモリ 11,492 KB
実行使用メモリ 20,028 KB
最終ジャッジ日時 2023-10-12 02:40:41
合計ジャッジ時間 4,847 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
19,604 KB
testcase_01 AC 84 ms
15,028 KB
testcase_02 AC 83 ms
15,064 KB
testcase_03 AC 142 ms
15,332 KB
testcase_04 AC 86 ms
15,116 KB
testcase_05 AC 146 ms
15,084 KB
testcase_06 AC 94 ms
15,280 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K = gets.split.map(&:to_i)
S = gets.chomp

0.upto(N - K) do |i|
  j = i + K - 1

  while i < j
    S[i], S[j] = S[j], S[i]

    i += 1
    j -= 1
  end
end

puts S
0