結果

問題 No.1429 Simple Dowsing
コンテスト
ユーザー kou_kkk
提出日時 2026-09-03 17:15:04
言語 F#
(F# 10.0 + ACL)
コンパイル:
fsharp_c _filename_
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 410 ms / 2,000 ms
+ 2µs
コード長 729 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 12,177 ms
コンパイル使用メモリ 216,984 KB
実行使用メモリ 40,104 KB
平均クエリ数 3.00
最終ジャッジ日時 2026-09-03 17:15:28
合計ジャッジ時間 17,797 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (305 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

open System

printfn "? 0 0"
stdout.Flush()

let res1 = Console.ReadLine() |> int

printfn "? 1 0"
stdout.Flush()
        
let res2 = Console.ReadLine() |> int

let f l r =
    let arr: array<list<int * int>> = Array.create 20005 []
    for x = l to r do
        for y = 0 to 100 do
            let idx = x * x + y * y
            arr.[idx] <- (x, y) :: arr.[idx]
    arr

let dist1 = f 0 100
let dist2 = f (-1) 99

let intersect xs ys =
    let mutable result = []
    for x in xs do
        for y in ys do
            if x = y then
                result <- x :: result
    result

dist2.[res2]
|> List.map (fun (a, b) -> (a + 1, b))
|> intersect dist1.[res1] 
|> List.head
|> fun (a, b) -> printfn "! %d %d" a b
stdout.Flush()
0