結果

問題 No.946 箱箱箱
ユーザー Rubikun
提出日時 2019-12-09 00:15:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 736 bytes
コンパイル時間 1,847 ms
コンパイル使用メモリ 162,696 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-02 21:19:53
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 28 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=2005;
const ll INF=1LL<<60;

bool dp[MAX];//0なら負け

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;cin>>N;
    vector<ll> A(N),xo(N+1);
    for(int i=0;i<N;i++){
        cin>>A[i];
        xo[i]=xo[i-1]^A[i];
    }
    
    dp[0]=0;
    
    for(int i=1;i<=N;i++){
        for(int j=0;j<i;j++){
            if(dp[j]==0&&(xo[j]^xo[i])==0) dp[i]=1;
            if(dp[j]==1&&(xo[j]^xo[i])!=0) dp[i]=1;
        }
    }
    
    if(dp[N]) cout<<"Takahashi"<<endl;
    else cout<<"Takanashi"<<endl;
}

0