結果
| 問題 | No.606 カラフルタイル | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-12-08 14:44:38 | 
| 言語 | F# (F# 4.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,111 bytes | 
| コンパイル時間 | 9,189 ms | 
| コンパイル使用メモリ | 187,368 KB | 
| 実行使用メモリ | 71,852 KB | 
| 最終ジャッジ日時 | 2024-11-29 19:14:38 | 
| 合計ジャッジ時間 | 17,788 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 10 WA * 12 RE * 3 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (780 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
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])
            
            
            
        