結果

問題 No.1707 Simple Range Reverse Problem
ユーザー maguroflymagurofly
提出日時 2021-10-15 21:34:22
言語 Ruby
(3.3.0)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 383 bytes
コンパイル時間 115 ms
コンパイル使用メモリ 11,860 KB
実行使用メモリ 31,092 KB
最終ジャッジ日時 2023-10-17 20:05:21
合計ジャッジ時間 2,741 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
16,048 KB
testcase_01 AC 89 ms
16,044 KB
testcase_02 AC 87 ms
16,048 KB
testcase_03 AC 87 ms
16,048 KB
testcase_04 AC 87 ms
17,480 KB
testcase_05 AC 89 ms
17,440 KB
testcase_06 AC 88 ms
16,804 KB
testcase_07 AC 85 ms
16,724 KB
testcase_08 AC 86 ms
16,736 KB
testcase_09 AC 94 ms
25,576 KB
testcase_10 AC 93 ms
25,080 KB
testcase_11 AC 88 ms
17,892 KB
testcase_12 AC 98 ms
30,300 KB
testcase_13 AC 100 ms
30,564 KB
testcase_14 AC 100 ms
31,092 KB
testcase_15 AC 102 ms
30,584 KB
testcase_16 AC 102 ms
30,828 KB
testcase_17 AC 98 ms
31,092 KB
testcase_18 AC 100 ms
30,568 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

T = gets.to_s.to_i
T.times do
    n = gets.to_s.to_i
    a = gets.to_s.split.map { |s| s.to_i }
    
    x = (0 ... n * 2).map { |i| i % n + 1 }
    
    if a == x
        puts "Yes"
        next
    end
    
    if (0 ... n).any? do |i|
        y = x.dup
        y[i, n + 1] = x[i, n + 1].reverse
        a == y
    end
        puts "Yes"
        next
    end
    
    puts "No"
end
0