結果
問題 | No.946 箱箱箱 |
ユーザー |
|
提出日時 | 2024-08-31 01:11:16 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,155 bytes |
コンパイル時間 | 3,670 ms |
コンパイル使用メモリ | 275,168 KB |
実行使用メモリ | 11,648 KB |
最終ジャッジ日時 | 2024-08-31 01:11:25 |
合計ジャッジ時間 | 9,452 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 WA * 5 |
ソースコード
#ifdef ONLINE_JUDGE#define NDEBUG#endif#if defined(__GNUC__) && !defined(__clang__)// #pragma GCC optimize("O3")// #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")#pragma GCC optimize("unroll-loops")#endif// workaround for codeforces g++20 compiler bug#if __cplusplus >= 202002L#define _EXT_CODECVT_SPECIALIZATIONS_H#define _EXT_ENC_FILEBUF_H#endif//#include <bits/stdc++.h>using namespace std;#if __cplusplus >= 202002Lnamespace R = ranges;namespace V = views;#endifusing i64 = long long;using u64 = unsigned long long;using f64 = double;using uz = size_t;using u32 = uint32_t;using itn = int;template <typename T> using ve = vector<T>;template <typename T> using a2 = array<T, 2>;template <typename K, typename V> using HashMap = unordered_map<K, V>;template <typename T> using HashSet = unordered_set<T>;template <typename T, typename C = less<T>>using PQ = std::priority_queue<T, vector<T>, C>;template <typename T, typename C = greater<T>>using miPQ = std::priority_queue<T, vector<T>, C>;#define mt make_tuple#define mp make_pair#ifdef LOCAL#include "debug_template.cpp"#else#define debug(...)#define debugArr(...)#endif// constexpr array<int, 5> dirs{-1, 0, 1, 0, -1};// constexpr char nesw[4]{'N', 'E', 'S', 'W'};// constexpr int M = 1e9 + 7;void cln() { cout << '\n'; }constexpr char ln = '\n';ve<int> pxor;array<int, 2002> dp;int g(int i);int g_impl(int i) {ve<int> s;s.reserve(pxor.size() - i);for (int j = i; j < pxor.size(); ++j) {s.push_back(pxor[j] ^ g(j + 1));}R::sort(s);int c = 0;for (int i = 0; i < s.size(); ++i) {if (s[i] > c) {return c;}if (s[i] == c) {++c;}}return c;}int g(int i) {if (i == pxor.size()) {return 0;}auto &memo = dp[i];if (memo != -1) {return memo;}return memo = g_impl(i);}int main() {#ifndef LOCALios::sync_with_stdio(0), cin.tie(0);#endif//dp.fill(-1);int n;cin >> n;pxor.resize(n);cin >> pxor[0];for (int i = 1; i < n; ++i) {cin >> pxor[i];pxor[i] ^= pxor[i - 1];}cout << (g(0) ? "Takahashi" : "Takanashi") << ln;}