結果

問題 No.946 箱箱箱
ユーザー aajisakaaajisaka
提出日時 2019-12-09 00:47:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,901 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 170,728 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-30 23:31:23
合計ジャッジ時間 3,815 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 6 ms
4,380 KB
testcase_04 AC 6 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 7 ms
4,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 8 ms
4,380 KB
testcase_10 AC 6 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 8 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 6 ms
4,380 KB
testcase_15 AC 6 ms
4,376 KB
testcase_16 AC 6 ms
4,380 KB
testcase_17 AC 6 ms
4,376 KB
testcase_18 AC 6 ms
4,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 8 ms
4,376 KB
testcase_22 AC 6 ms
4,376 KB
testcase_23 AC 6 ms
4,376 KB
testcase_24 AC 9 ms
4,376 KB
testcase_25 WA -
testcase_26 AC 7 ms
4,376 KB
testcase_27 WA -
testcase_28 AC 6 ms
4,376 KB
testcase_29 AC 6 ms
4,376 KB
testcase_30 WA -
testcase_31 AC 6 ms
4,376 KB
testcase_32 WA -
testcase_33 AC 6 ms
4,376 KB
testcase_34 AC 6 ms
4,380 KB
testcase_35 AC 6 ms
4,380 KB
testcase_36 AC 6 ms
4,380 KB
testcase_37 AC 7 ms
4,376 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 6 ms
4,376 KB
testcase_42 WA -
testcase_43 AC 7 ms
4,376 KB
testcase_44 WA -
testcase_45 AC 6 ms
4,380 KB
testcase_46 AC 6 ms
4,380 KB
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 1 ms
4,376 KB
testcase_52 WA -
testcase_53 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using ll = long long;
using P = pair<ll, ll>;

constexpr double PI = 3.14159265358979323846;
mt19937_64 engine(chrono::steady_clock::now().time_since_epoch().count());

class hakohakohako {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int n; cin >> n;
      vector<int> a(n);
      rep(i, n) {
        cin >> a[i];
      }

      vector<bool> dp(n+1);
      dp[0] = true;
      for(int i=1; i<=n; i++) {
        vector<int> b;
        for(int j=n-i; j<n; j++) {
          b.push_back(a[j]);
        }
        int k = b.size();
        if (k==1) {
          dp[1] = false;
          continue;
        }
        int p = 0;
        rep(j, k) {
          p ^= b[j];
          debug(i, k, j, b[j], p);
          if (p==0) {
            dp[k] = dp[k] || dp[k-j-1];
          }
        }
      }

      string s;
      if (dp[n]) {
        s = "Takahashi";
      } else {
        s = "Takanashi";
      }
      cout << s << endl;
    }
};

signed main() {
  hakohakohako solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
0