結果

問題 No.250 atetubouのzetubou
コンテスト
ユーザー te-sh
提出日時 2017-05-25 17:22:45
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
AC  
実行時間 2,939 ms / 5,000 ms
コード長 645 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,630 ms
コンパイル使用メモリ 143,088 KB
実行使用メモリ 23,412 KB
最終ジャッジ日時 2026-03-05 14:49:18
合計ジャッジ時間 30,897 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import std.algorithm, std.conv, std.range, std.stdio, std.string;
import std.bigint;    // BigInt

void main()
{
  auto q = readln.chomp.to!size_t;
  auto di = new int[](q), xi = new int[](q), ti = new long[](q);
  foreach (i; 0..q) {
    auto rd = readln.split;
    di[i] = rd[0].to!int; xi[i] = rd[1].to!int; ti[i] = rd[2].to!long;
  }

  auto maxXD = zip(di, xi).map!"a[0] + a[1]".maxElement;
  auto facts = new BigInt[](maxXD);
  facts[0] = 1;
  foreach (i; 1..maxXD)
    facts[i] = facts[i-1] * i;

  foreach (d, x, t; lockstep(di, xi, ti)) {
    auto c = facts[x+d-1] / facts[x] / facts[d-1];
    writeln(c <= t ? "AC" : "ZETUBOU");
  }
}
0