結果
| 問題 |
No.946 箱箱箱
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2019-12-09 00:15:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 363 ms / 2,000 ms |
| コード長 | 597 bytes |
| コンパイル時間 | 1,732 ms |
| コンパイル使用メモリ | 176,208 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 02:57:25 |
| 合計ジャッジ時間 | 13,164 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<int> a(n);
for (auto&& e : a) {
cin >> e;
}
auto c = a;
c.push_back(0);
for (int i = n; i--; ) {
c[i] ^= c[i + 1];
}
vector<int> dp(n + 1);
for (int i = n; i--; ) {
set<int> se;
for (int j = i + 1; j <= n; ++j) {
se.insert(c[i] ^ c[j] ^ dp[j]);
}
for (int x = 0; ; ++x) {
if (not se.count(x)) {
dp[i] = x;
break;
}
}
}
cout << (dp[0] ? "Takahashi" : "Takanashi") << '\n';
}
risujiroh