結果

問題 No.250 atetubouのzetubou
ユーザー penguinshunyapenguinshunya
提出日時 2019-07-23 19:50:25
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 81 ms / 5,000 ms
コード長 767 bytes
コンパイル時間 1,438 ms
コンパイル使用メモリ 165,968 KB
実行使用メモリ 21,464 KB
最終ジャッジ日時 2023-09-08 14:27:45
合計ジャッジ時間 3,855 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
21,128 KB
testcase_01 AC 60 ms
21,228 KB
testcase_02 AC 78 ms
21,172 KB
testcase_03 AC 81 ms
21,464 KB
testcase_04 AC 77 ms
21,144 KB
testcase_05 AC 79 ms
21,156 KB
testcase_06 AC 75 ms
21,184 KB
testcase_07 AC 66 ms
21,172 KB
testcase_08 AC 78 ms
21,232 KB
testcase_09 AC 74 ms
21,124 KB
testcase_10 AC 79 ms
21,244 KB
testcase_11 AC 71 ms
21,128 KB
testcase_12 AC 78 ms
21,136 KB
testcase_13 AC 69 ms
21,308 KB
testcase_14 AC 58 ms
21,192 KB
testcase_15 AC 32 ms
9,696 KB
testcase_16 AC 29 ms
9,540 KB
testcase_17 AC 31 ms
9,612 KB
testcase_18 AC 32 ms
9,536 KB
testcase_19 AC 30 ms
9,524 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

long long memo[1510][1510];
long long f(int x, int d) {
  if (memo[x][d] > 0) {
    return memo[x][d];
  }
  long long ret;
  if (x == 0) {
    ret = 1;
  } else if (d == 1) {
    ret = x + 1;
  } else {
    ret = f(x - 1, d) + f(x, d - 1);
    if (ret > 1e16) {
      ret = 1e16;
    }
  }
  return memo[x][d] = ret;
}

int main() {
  int Q; cin >> Q;
  for (int i = 0; i < Q; i++) {
    int d, x;
    long long t;
    cin >> d >> x >> t;
    if (d == 1) {
      if (t > 0) {
        cout << "AC" << endl;
      } else {
        cout << "ZETUBOU" << endl;
      }
    } else {
      if (f(x, d - 1) <= t) {
        cout << "AC" << endl;
      } else {
        cout << "ZETUBOU" << endl;
      }
    }
  }
  return 0;
}
0