結果

問題 No.514 宝探し3
ユーザー te-shte-sh
提出日時 2017-05-05 23:34:52
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 84,780 KB
実行使用メモリ 24,360 KB
平均クエリ数 4.08
最終ジャッジ日時 2023-09-03 13:10:06
合計ジャッジ時間 2,049 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
23,412 KB
testcase_01 AC 24 ms
24,048 KB
testcase_02 AC 24 ms
23,676 KB
testcase_03 AC 25 ms
23,388 KB
testcase_04 AC 24 ms
23,412 KB
testcase_05 AC 25 ms
23,676 KB
testcase_06 AC 25 ms
23,448 KB
testcase_07 AC 26 ms
24,060 KB
testcase_08 AC 25 ms
23,688 KB
testcase_09 AC 25 ms
23,664 KB
testcase_10 AC 25 ms
24,288 KB
testcase_11 AC 24 ms
24,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

const ma = 1000000000;

void main()
{
  auto ans = int.max;
  auto xi = 0, xa = ma;
  auto yi = 0, ya = ma;
  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 = (ma - (ra - ri)) / 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 = (ma - (ra - ri)) / 2;
  writeln(x, " ", y); stdout.flush();
  readln.chomp.to!int;
}
0