結果

問題 No.619 CardShuffle
ユーザー くれちー
提出日時 2017-12-12 07:46:49
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 240 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 195,952 KB
最終ジャッジ日時 2024-12-22 21:14:36
合計ジャッジ時間 77,923 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14 WA * 3 TLE * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Main.rb:4: warning: assigned but unused variable - i
Syntax OK

ソースコード

diff #

n = gets.to_i
c = gets.chomp.delete(' ')
q = gets.to_i
for i in 1 .. q do
    t, *p = gets.split
    x, y = p.map(&:to_i).map{|n| n - 1}
    if t == "!" then
        c[y], c[x] = c[x], c[y]
    else
        puts (eval c[x .. y])
    end
end
0