結果

問題 No.946 箱箱箱
ユーザー chocorusk
提出日時 2019-12-10 08:45:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 355 ms / 2,000 ms
コード長 1,073 bytes
コンパイル時間 1,003 ms
コンパイル使用メモリ 114,760 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 03:27:13
合計ジャッジ時間 12,604 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

int main()
{
    int n;
    cin>>n;
    int a[2020];
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    int g[2020];
    g[n]=0;
    for(int i=n-1; i>=0; i--){
        set<int> st;
        int s=0;
        for(int j=i; j<n; j++){
            s^=a[j];
            st.insert(s^g[j+1]);
        }
        for(int j=0; ; j++){
            if(st.find(j)==st.end()){
                g[i]=j;
                break;
            }
        }
    }
    if(g[0]==0) cout<<"Takanashi"<<endl;
    else cout<<"Takahashi"<<endl;
    return 0;
}
0