結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー chiho_miyako
提出日時 2015-04-17 00:13:56
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 1,099 bytes
コンパイル時間 3,469 ms
コンパイル使用メモリ 76,704 KB
実行使用メモリ 165,320 KB
最終ジャッジ日時 2024-07-04 15:16:52
合計ジャッジ時間 9,863 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 4 RE * 1 TLE * 1 -- * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner koko = new Scanner(System.in);
        int n = koko.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++){
            a[i]=koko.nextInt();
        }
        boolean[][] haita = new boolean[n+1][16385];
        haita[0][0]=true;
            for(int j=0; j<16385; j++){
                for(int i=0; i<n; i++){
                    boolean[] b = new boolean[n];
                    for(int l=0; l<n; l++){
                        if(haita[i][j]){
                            if(!b[l]){
                                haita[i+1][j^a[l]]=true;
                                b[l]=true;
                            }
                        }
                    }
                }
            }
        int count=0;
        for(int i=0; i<16385; i++){
            for(int j=0; j<n+1; j++){
                if(haita[j][i]){
                    count++;
                    break;
                }
            }
        }
        System.out.println(count);
    }
}
0