結果

問題 No.250 atetubouのzetubou
ユーザー cympfhcympfh
提出日時 2015-08-22 14:17:13
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 1,947 bytes
コンパイル時間 1,240 ms
コンパイル使用メモリ 150,380 KB
実行使用メモリ 40,860 KB
最終ジャッジ日時 2023-09-25 16:10:22
合計ジャッジ時間 3,435 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
40,792 KB
testcase_01 AC 43 ms
40,860 KB
testcase_02 AC 58 ms
40,624 KB
testcase_03 AC 58 ms
40,728 KB
testcase_04 AC 57 ms
40,700 KB
testcase_05 AC 57 ms
40,620 KB
testcase_06 AC 52 ms
40,696 KB
testcase_07 AC 47 ms
40,736 KB
testcase_08 AC 55 ms
40,860 KB
testcase_09 AC 52 ms
40,624 KB
testcase_10 AC 55 ms
40,844 KB
testcase_11 AC 50 ms
40,792 KB
testcase_12 AC 55 ms
40,692 KB
testcase_13 AC 49 ms
40,628 KB
testcase_14 AC 42 ms
40,740 KB
testcase_15 AC 58 ms
40,844 KB
testcase_16 AC 58 ms
40,784 KB
testcase_17 AC 58 ms
40,728 KB
testcase_18 AC 57 ms
40,848 KB
testcase_19 AC 57 ms
40,736 KB
testcase_20 AC 41 ms
40,740 KB
testcase_21 AC 41 ms
40,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<(n);++i)
#define loop for(;;)
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;
#define inf (1e9)
#define eps (1e-9)
using Integer = unsigned long long;
using Real = long double;
const Real PI = acosl(-1);

template<class S, class T> inline
ostream& operator<<(ostream&os, pair<S,T> p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template<class S, class T, class U> inline
ostream& operator<<(ostream&os, tuple<S,T,U> t) {
  return os << '('
    << get<0>(t) << ", "
    << get<1>(t) << ", "
    << get<2>(t) << ')';
}

template<class T> inline
ostream& operator<<(ostream&os, vector<T> v) {
  if (v.size() == 0) { return os << "(empty)"; }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

template<class T> inline
istream& operator>>(istream&is, vector<T>&v) {
  rep (i, v.size()) is >> v[i];
  return is;
}

//           ^   >  v   <
int dx[] = { -1, 0, 1,  0 };
int dy[] = {  0, 1, 0, -1 };

using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;

const Integer M = 1000000000000000;

vector<vector<Integer>> PascalTriangle(int n)
{
  vector<vector<Integer>> cc(n);
  for (int i = 0; i < n; ++i) {
    cc[i].resize(i + 1);
    for (int j = 0; j <= i; ++j) {
      cc[i][j] =
        (!i || !j || i == j) ? 1 : cc[i-1][j] + cc[i-1][j-1];
      if (cc[i][j] > M) cc[i][j] = M+1;
    }
  }
  return cc;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout.setf(ios::fixed);
  cout.precision(10);
  random_device dev;
  mt19937 rand(dev());

  auto pt = PascalTriangle(3100);

  int q; cin >> q;
  while (q--) {
    int d, x; cin >> d >> x;
    Integer t; cin >> t;
    int m = d + x - 1;
    int n = min(d-1, x);
    Integer a = pt[m][n];
    cout <<
      ((a <= t) ? "AC" : "ZETUBOU")
      << endl;
  }

  return 0;
}
0