結果

問題 No.250 atetubouのzetubou
ユーザー どららどらら
提出日時 2015-09-27 04:04:01
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,184 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 74,716 KB
実行使用メモリ 123,772 KB
最終ジャッジ日時 2023-09-26 16:42:46
合計ジャッジ時間 13,306 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <iostream>
#include <queue>
#include <list>
#include <stack>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;

ll f[5000][5000];

ll Comb(int n, int k){
  if(n-k<k) k = n-k;
  if(k==0) return 1;
  if(k==1) return n;

  for(int i=0; i<n+1; i++) f[0][i] = f[i][0] = 1;
  for(int i=1; i<n+1; i++) for(int j=1; j<n+1; j++){
    f[i][j] = f[i-1][j]+f[i][j-1];
    if(f[i][j]>1000000000000000LL||f[i-1][j]<0||f[i][j-1]<0) f[i][j]=-1LL;
    if(i+j==n && j==k) return f[i][j];
  }
  return 1;
}

bool calc(ll D, ll X, ll T){
  ll res = Comb(X+D-1, D-1);
  if(res == -1) return false;
  return res <= T;
}

int main(){
  int Q;
  cin >> Q;
  rep(i,Q){
    ll D, X, T;
    cin >> D >> X >> T;
    if(calc(D, X, T)) cout << "AC" << endl;
    else cout << "ZETUBOU" << endl;
  }
  
  return 0;
}
0