結果

問題 No.946 箱箱箱
ユーザー tko919tko919
提出日時 2019-12-09 00:40:38
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 863 bytes
コンパイル時間 1,488 ms
コンパイル使用メモリ 161,924 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2025-01-02 22:56:00
合計ジャッジ時間 3,557 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35 WA * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:17:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |     int n; scanf("%d",&n);
      |            ~~~~~^~~~~~~~~
main.cpp:19:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |     rep(i,0,n)scanf("%d",&a[i]);
      |               ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; const int inf = 0x3fffffff; const ll INF = 0x3fffffffffffffff;
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end



int main(){
    int n; scanf("%d",&n);
    vector<int> a(n);
    rep(i,0,n)scanf("%d",&a[i]);
    bool ans[2010]; rep(i,0,n+1)ans[i]=1;
    reverse(ALL(a));
    rep(i,0,n){
        int g=0;
        rep(j,0,i+1){
            g^=a[j];
            if(g==0&&ans[j])ans[i+1]=0;
        }
    }
    rep(i,0,n+1)cerr<<ans[i]<<endl;
    printf(ans[n]?"Takanashi":"Takahashi");
    return 0;
}
0