結果
問題 |
No.946 箱箱箱
|
ユーザー |
![]() |
提出日時 | 2019-11-30 06:08:54 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 17 ms / 2,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 2,115 ms |
コンパイル使用メモリ | 195,612 KB |
最終ジャッジ日時 | 2025-01-08 06:25:15 |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 51 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){cin.tie(0);ios::sync_with_stdio(false); int N;cin>>N; vector<int>A(N),S(N+1),G(N+1); S[0]=0; for(int i=0;i<N;++i){ cin>>A[i]; S[i+1]=S[i]^A[i]; } G[N]=0; vector<int>v(N,N); for(int i=N-1;i>=0;--i){ for(int j=i+1;j<=N;++j){ int t=S[i]^S[j]^G[j]; if(t<N-i){ v[t]=i; } } G[i]=0; for(int j=0;j<N-i&&v[j]==i;++j){ ++G[i]; } } if(G[0]==0){ cout<<"Takanashi\n"; }else{ cout<<"Takahashi\n"; } return 0; }