結果

問題 No.513 宝探し2
ユーザー te-shte-sh
提出日時 2017-05-05 23:21:15
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 936 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 84,184 KB
実行使用メモリ 24,360 KB
平均クエリ数 4.17
最終ジャッジ日時 2023-09-03 13:09:47
合計ジャッジ時間 2,493 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
23,400 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 23 ms
23,688 KB
testcase_04 WA -
testcase_05 AC 24 ms
23,664 KB
testcase_06 WA -
testcase_07 AC 23 ms
24,036 KB
testcase_08 AC 23 ms
23,640 KB
testcase_09 AC 23 ms
24,048 KB
testcase_10 WA -
testcase_11 AC 23 ms
24,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto ans = int.max;
  auto xi = 0, xa = 100000;
  auto yi = 0, ya = 100000;
  auto ri = 0, ra = 0;

  writeln(xi, " ", yi); stdout.flush();
  ri = readln.chomp.to!int;
  if (ri == 0)
    return;

  writeln(xa, " ", yi); stdout.flush();
  ra = readln.chomp.to!int;
  if (ra == 0)
    return;

  auto x = 0;
  if (ri < ra) {
    x = (xa - (ra - ri)) / 2;
  } else if (ri > ra) {
    x = (xi + (ri - ra)) / 2;
  } else {
    x = (xa + xi) / 2;
  }

  writeln(x, " ", yi); stdout.flush();
  ri = readln.chomp.to!int;
  if (ri == 0)
    return;

  writeln(x, " ", ya); stdout.flush();
  ra = readln.chomp.to!int;
  if (ra == 0)
    return;

  auto y = 0;
  if (ri < ra) {
    y = (ya - (ra - ri)) / 2;
   } else if (ri > ra) {
    y = (yi + (ri - ra)) / 2;
  } else {
    y = (ya + yi) / 2;
  }
  writeln(x, " ", y); stdout.flush();
  readln.chomp.to!int;
}
0