結果

問題 No.2535 多重同値
ユーザー steinnsteinn
提出日時 2023-11-10 22:15:06
言語 Julia
(1.10.2)
結果
AC  
実行時間 314 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 255,072 KB
最終ジャッジ日時 2024-04-09 14:32:56
合計ジャッジ時間 7,005 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 272 ms
242,744 KB
testcase_01 AC 268 ms
242,728 KB
testcase_02 AC 268 ms
243,448 KB
testcase_03 AC 269 ms
242,820 KB
testcase_04 AC 269 ms
242,976 KB
testcase_05 AC 266 ms
242,240 KB
testcase_06 AC 269 ms
243,736 KB
testcase_07 AC 271 ms
244,912 KB
testcase_08 AC 268 ms
242,872 KB
testcase_09 AC 268 ms
243,712 KB
testcase_10 AC 271 ms
244,988 KB
testcase_11 AC 272 ms
243,212 KB
testcase_12 AC 269 ms
242,088 KB
testcase_13 AC 271 ms
245,516 KB
testcase_14 AC 269 ms
242,604 KB
testcase_15 AC 269 ms
244,664 KB
testcase_16 AC 275 ms
245,420 KB
testcase_17 AC 313 ms
254,544 KB
testcase_18 AC 312 ms
253,916 KB
testcase_19 AC 314 ms
255,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

parseInts() = parse.(Int64, readline()::String |> split)::Vector{Int64}
parseInt() = parse(Int64, readline()::String)::Int64

function eq(a, b)
    # 1=true, 2=false
    return (a == b ? 1 : 2)
end

function main()
    n = parseInt()
    p = fill(0, n)
    for i = 1:n
        p[i] = (readline() == "Yes" ? 1 : 2)
    end
    # qの2個目の添字は 1=true, 2=false
    q = fill(0, n, 2)
    q[1, 1] = 1
    q[1, 2] = 2
    for i = 1:n-1
        q[i+1, 1] = q[i, eq(p[i], 1)]
        q[i+1, 2] = q[i, eq(p[i], 2)]
    end
    for i = 1:n
        (q[i, p[i]] == 1 ? "Yes" : "No") |> println
    end
end

main()
0