結果

問題 No.513 宝探し2
ユーザー vorg101vorg101
提出日時 2017-05-05 23:15:23
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 1,510 bytes
コンパイル時間 4,047 ms
コンパイル使用メモリ 103,188 KB
実行使用メモリ 38,628 KB
平均クエリ数 73.25
最終ジャッジ日時 2023-09-23 13:46:16
合計ジャッジ時間 6,307 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Program
{
    private static readonly Scanner sc = new Scanner();
    private static readonly int INF = 1010101010;
    static void Main(string[] args)
    {
        int top = 100001;
        int bottom = 0;
        int right = 100001;
        int left = 0;
        int mind = INF;

        while(true)
        {
            int xmid = (right + left) / 2;
            int ymid = (top + bottom) / 2;
            Console.WriteLine("{0} {1}", xmid, ymid);
            int d = sc.Int;
            int nd;

            Console.WriteLine("{0} {1}", xmid+1, ymid);
            nd = sc.Int;
            if (nd < d) left = xmid;
            Console.WriteLine("{0} {1}", xmid-1, ymid);
            nd = sc.Int;
            if (nd < d) right = xmid;
            Console.WriteLine("{0} {1}", xmid, ymid+1);
            nd = sc.Int;
            if (nd < d) bottom = ymid;
            Console.WriteLine("{0} {1}", xmid, ymid-1);
            nd = sc.Int;
            if (nd < d) top = ymid;
        }
    }
}

class Scanner
{
    private string[] _str = new string[0];
    private int _i;

    public string Str
    {
        get
        {
            if (_i >= _str.Length)
            {
                _str = Console.ReadLine().Split(' ');
                _i = 0;
            }
            return _str[_i++];
        }
    }

    public int Int { get { return int.Parse(Str); } }
    public long Long { get { return long.Parse(Str); } }
    public double Double { get { return double.Parse(Str); } }
}
0