結果
問題 | No.606 カラフルタイル |
ユーザー | nebukuro09 |
提出日時 | 2017-12-08 14:44:38 |
言語 | F# (F# 4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,111 bytes |
コンパイル時間 | 4,386 ms |
コンパイル使用メモリ | 168,268 KB |
実行使用メモリ | 52,048 KB |
最終ジャッジ日時 | 2023-08-19 22:23:55 |
合計ジャッジ時間 | 13,292 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 71 ms
22,480 KB |
testcase_01 | AC | 68 ms
22,516 KB |
testcase_02 | WA | - |
testcase_03 | RE | - |
testcase_04 | AC | 68 ms
24,508 KB |
testcase_05 | AC | 71 ms
22,460 KB |
testcase_06 | AC | 70 ms
24,384 KB |
testcase_07 | RE | - |
testcase_08 | AC | 70 ms
20,208 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 77 ms
22,444 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 164 ms
28,488 KB |
testcase_17 | AC | 661 ms
39,908 KB |
testcase_18 | AC | 219 ms
36,096 KB |
testcase_19 | AC | 224 ms
37,552 KB |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | RE | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 717 ms
45,404 KB |
testcase_27 | WA | - |
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0 Copyright (c) Microsoft Corporation. All Rights Reserved.
ソースコード
open System; let input:String array=Console.ReadLine().Split(' ') let N = int(input.[0]) let K = int(input.[1]) let Q = int(input.[2]) let mutable row = [for i in 0..N-1 -> (1, i)] |> Seq.toArray let mutable col = [for i in N..N+N-1 -> (1, i)] |> Seq.toArray let mutable colors = [for i in 1..K -> 0L] |> Seq.toArray let rec binsearch (arr: (int * int)[], hi: int, lo: int, v: int) = if hi - lo <= 1 then lo elif snd arr.[(hi+lo)/2] < v then binsearch(arr, hi, (hi+lo)/2, v) else binsearch(arr, (hi+lo)/2, lo, v) for i in N+N..N+N+Q-1 do let s:String array=Console.ReadLine().Split(' ') let A = s.[0] let B = int(s.[1]) - 1 let C = int(s.[2]) - 1 if A = "R" then row.[B] <- (C, i) else col.[B] <- (C, i) row <- Array.sortBy(fun (_, y) -> y) row col <- Array.sortBy(fun (_, y) -> y) col for i in 0..N-1 do colors.[fst row.[i]] <- colors.[fst row.[i]] + int64(binsearch(col, N, -1, snd row.[i]) + 1) for i in 0..N-1 do colors.[fst col.[i]] <- colors.[fst col.[i]] + int64(binsearch(row, N, -1, snd col.[i]) + 1) for i in 0..K-1 do Console.WriteLine(colors.[i])