結果

問題 No.365 ジェンガソート
ユーザー Shirakazu EijiShirakazu Eiji
提出日時 2021-03-13 10:45:37
言語 Swift
(5.10.0)
結果
WA  
実行時間 -
コード長 487 bytes
コンパイル時間 12,094 ms
コンパイル使用メモリ 184,012 KB
実行使用メモリ 22,560 KB
最終ジャッジ日時 2024-04-23 04:23:51
合計ジャッジ時間 16,929 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 10 ms
15,616 KB
testcase_03 AC 10 ms
15,488 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 OLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import Foundation

func readInt() -> Int {
    return Int(readLine()!)!
}

func readIntsArray() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let n = readInt()
    var count = 0
    var a = readIntsArray()
    for i in 0..<n {
        if i+1 == n {
            break
        } else if a[i] > a[i+1] {
            a[i] = a[i+1]
            a[i+1] = a[i]
            count += 1
            print(a)
        }
    }
    print(count)
}

main()
0