結果

問題 No.305 鍵(2)
ユーザー te-shte-sh
提出日時 2017-06-15 17:52:24
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 84,800 KB
実行使用メモリ 24,312 KB
平均クエリ数 94.00
最終ジャッジ日時 2023-09-03 14:28:29
合計ジャッジ時間 2,560 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
23,364 KB
testcase_01 AC 30 ms
24,036 KB
testcase_02 AC 30 ms
23,376 KB
testcase_03 AC 29 ms
23,628 KB
testcase_04 AC 30 ms
24,084 KB
testcase_05 AC 30 ms
24,312 KB
testcase_06 AC 25 ms
24,288 KB
testcase_07 AC 30 ms
23,532 KB
testcase_08 AC 29 ms
24,060 KB
testcase_09 AC 30 ms
23,412 KB
testcase_10 AC 29 ms
23,820 KB
testcase_11 AC 30 ms
23,388 KB
testcase_12 AC 29 ms
23,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void main()
{
  auto r = new int[](10); r[] = -1;

  foreach (i; 0..10) {
    auto a = new int[](10);
    a[] = i;

    auto x = ask(a);
    if (x == 10) return;
    foreach (j; 0..10) {
      auto b = a.dup; b[j] = (b[j] + 1) % 10;
      auto y = ask(b);
      if (y == 10) return;
      if (y < x) r[j] = i;
    }
  }

  r.each!write; writeln; stdout.flush();
}

auto ask(int[] a)
{
  a.each!write; writeln; stdout.flush();
  auto rd = readln.split;
  return rd[0].to!int;
}
0