結果

問題 No.1741 Arrays and XOR Procedure
ユーザー CuriousFairy315CuriousFairy315
提出日時 2021-11-12 22:57:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 637 ms / 2,000 ms
コード長 739 bytes
コンパイル時間 2,124 ms
コンパイル使用メモリ 71,168 KB
実行使用メモリ 65,728 KB
最終ジャッジ日時 2023-08-17 03:25:06
合計ジャッジ時間 22,558 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,392 KB
testcase_01 AC 123 ms
55,768 KB
testcase_02 AC 122 ms
56,008 KB
testcase_03 AC 587 ms
65,100 KB
testcase_04 AC 120 ms
55,836 KB
testcase_05 AC 607 ms
64,772 KB
testcase_06 AC 621 ms
65,252 KB
testcase_07 AC 637 ms
64,300 KB
testcase_08 AC 597 ms
64,824 KB
testcase_09 AC 588 ms
63,828 KB
testcase_10 AC 586 ms
64,524 KB
testcase_11 AC 513 ms
61,300 KB
testcase_12 AC 475 ms
60,528 KB
testcase_13 AC 573 ms
65,728 KB
testcase_14 AC 481 ms
60,908 KB
testcase_15 AC 570 ms
63,500 KB
testcase_16 AC 230 ms
59,092 KB
testcase_17 AC 401 ms
59,964 KB
testcase_18 AC 522 ms
61,060 KB
testcase_19 AC 221 ms
59,348 KB
testcase_20 AC 616 ms
64,244 KB
testcase_21 AC 561 ms
62,584 KB
testcase_22 AC 505 ms
61,400 KB
testcase_23 AC 358 ms
60,428 KB
testcase_24 AC 246 ms
59,764 KB
testcase_25 AC 622 ms
64,304 KB
testcase_26 AC 446 ms
60,428 KB
testcase_27 AC 219 ms
59,384 KB
testcase_28 AC 514 ms
62,084 KB
testcase_29 AC 575 ms
63,056 KB
testcase_30 AC 546 ms
62,180 KB
testcase_31 AC 222 ms
57,692 KB
testcase_32 AC 448 ms
60,284 KB
testcase_33 AC 467 ms
60,364 KB
testcase_34 AC 355 ms
60,600 KB
testcase_35 AC 179 ms
57,140 KB
testcase_36 AC 263 ms
60,200 KB
testcase_37 AC 433 ms
60,648 KB
testcase_38 AC 607 ms
62,376 KB
testcase_39 AC 421 ms
60,248 KB
testcase_40 AC 186 ms
58,712 KB
testcase_41 AC 314 ms
60,504 KB
testcase_42 AC 218 ms
60,012 KB
testcase_43 AC 119 ms
55,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int N = sc.nextInt();
			int[] B = new int[N];
			for (int i = 0;i < N;++ i) B[i] = sc.nextInt();
			final int MOD = 998_244_353;
			int use = -1, ans = 1, sum = 0;
			for (int i = 0;i < N;++ i) {
				if (B[i] == -1) {
					if (combination_mod2(N - 1, i) == 0) ans = ans * 2 % MOD;
					else ++ use;
				} else if (combination_mod2(N - 1, i) != 0) sum = sum + B[i] & 1;
			}
			if (use < 0 && sum == 0) System.out.println(0);
			else {
				while(use --> 0) ans = ans * 2 % MOD;
				System.out.println(ans);
			}
		}
	}
	
	static int combination_mod2(int n, int k) {
		return (n & k) == k ? 1 : 0;
	}
}
0