結果

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

テストケース

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

ソースコード

diff #

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

const ma = 100000;

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