結果
| 問題 |
No.946 箱箱箱
|
| コンテスト | |
| ユーザー |
hitonanode
|
| 提出日時 | 2019-12-09 00:15:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 239 ms / 2,000 ms |
| コード長 | 864 bytes |
| コンパイル時間 | 1,644 ms |
| コンパイル使用メモリ | 176,044 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 02:56:55 |
| 合計ジャッジ時間 | 11,921 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
int main()
{
int N;
cin >> N;
vector<int> A(N);
cin >> A;
reverse(A.begin(), A.end());
vector<int> AA(N + 1);
REP(i, N) AA[i + 1] = AA[i] ^ A[i];
vector<int> grundy(N + 1);
REP(i, N) {
unordered_set<int> trans;
REP(j, i + 1) trans.insert(grundy[j] ^ (AA[i + 1] ^ AA[j]));
int g = 0;
while (trans.count(g)) g++;
grundy[i + 1] = g;
}
cout << (grundy[N] ? "Takahashi" : "Takanashi") << endl;
}
hitonanode