結果

問題 No.513 宝探し2
ユーザー 14番14番
提出日時 2017-05-29 05:37:51
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 2,721 bytes
コンパイル時間 2,175 ms
コンパイル使用メモリ 105,660 KB
実行使用メモリ 39,124 KB
平均クエリ数 69.50
最終ジャッジ日時 2023-09-23 14:11:25
合計ジャッジ時間 5,403 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 AC 74 ms
37,800 KB
testcase_09 AC 77 ms
36,904 KB
testcase_10 AC 72 ms
37,256 KB
testcase_11 AC 73 ms
37,768 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.IO;
using System.Linq;

public class Program
{

    public void Proc() {
        GetAns(0,0,100000,100000);
    }

    private void GetAns(int xMin, int yMin, int xMax, int yMax) {
        int xMid1 = xMin + (xMax + xMin) / 3;
        int yMid1 = yMin + (yMax + yMin) / 3;
        int xMid2 = xMax - (xMax + xMin) / 3;
        int yMid2 = yMax - (yMax + yMin) / 3;
        int[] kyori = new int[16];

        for (int i = 0; i < 16; i++) {
            int x = xMin;
            if(i/4==1) {
                x = xMid1;
            } else if(i/4==2) {
                x = xMid2;
            } else if(i/4==3) {
                x = xMax;
            }
            int y = yMin;
            if(i%4==1) {
                y = yMid1;
            } else if(i%4==2) {
                y = yMid2;
            } else if(i%4==3) {
                y = yMax;
            }
            int tmp = Tell(x, y);
            if(tmp==0) {
                return;
            }
            kyori[i] = tmp;
        }
        int min = kyori.Min();
        for (int i = 0; i < 16; i++) {
            if(min!=kyori[i]) {
                continue;
            }
            int nextXMin = xMin;
            int nextXMax = xMid1;
            if(i/4==1) {
                nextXMax = xMid2;
            } else if(i/4==2) {
                nextXMin = xMid1;
                nextXMax = xMax;
            } else if(i/4==3) {
                nextXMin = xMid2;
                nextXMax = xMax;
            }
            int nextYMin = yMin;
            int nextYMax = yMid1;
            if(i%4==1) {
                nextYMax = yMid2;
            } else if(i%4==2) {
                nextYMin = yMid1;
                nextYMax = yMax;
            } else if(i%4==3) {
                nextYMin = yMid2;
                nextYMax = yMax;
            }
            GetAns(nextXMin, nextYMin, nextXMax, nextYMax);
            return;
        }

    }

    private int Tell(int x, int y) {
        Console.WriteLine(x + " " + y);
        return int.Parse(Console.ReadLine());
    }



    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine() {
            if(IsDebug) {
                if(sr == null) {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            } else {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"
        
aaaaaaa


";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
	}
}
0