結果
| 問題 |
No.513 宝探し2
|
| コンテスト | |
| ユーザー |
14番
|
| 提出日時 | 2017-05-29 05:37:51 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 2,721 bytes |
| コンパイル時間 | 1,074 ms |
| コンパイル使用メモリ | 115,408 KB |
| 実行使用メモリ | 43,332 KB |
| 平均クエリ数 | 69.50 |
| 最終ジャッジ日時 | 2024-07-16 13:49:58 |
| 合計ジャッジ時間 | 4,483 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 RE * 8 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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();
}
}
14番