結果

問題 No.1741 Arrays and XOR Procedure
ユーザー ああいいああいい
提出日時 2021-12-08 12:46:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 126 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 24,604 KB
最終ジャッジ日時 2023-09-23 04:56:03
合計ジャッジ時間 6,035 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,856 KB
testcase_01 AC 16 ms
8,112 KB
testcase_02 AC 16 ms
7,744 KB
testcase_03 AC 226 ms
24,604 KB
testcase_04 AC 15 ms
7,768 KB
testcase_05 AC 148 ms
11,504 KB
testcase_06 AC 187 ms
18,440 KB
testcase_07 AC 195 ms
18,252 KB
testcase_08 AC 153 ms
11,424 KB
testcase_09 AC 156 ms
14,676 KB
testcase_10 AC 165 ms
14,924 KB
testcase_11 AC 126 ms
13,532 KB
testcase_12 AC 107 ms
12,524 KB
testcase_13 AC 151 ms
14,400 KB
testcase_14 AC 117 ms
12,828 KB
testcase_15 AC 139 ms
14,232 KB
testcase_16 AC 24 ms
8,532 KB
testcase_17 AC 64 ms
10,544 KB
testcase_18 AC 122 ms
12,932 KB
testcase_19 AC 23 ms
8,468 KB
testcase_20 AC 174 ms
15,988 KB
testcase_21 AC 133 ms
13,952 KB
testcase_22 AC 126 ms
13,556 KB
testcase_23 AC 59 ms
10,284 KB
testcase_24 AC 27 ms
8,744 KB
testcase_25 AC 178 ms
15,680 KB
testcase_26 AC 81 ms
11,136 KB
testcase_27 AC 22 ms
8,420 KB
testcase_28 AC 134 ms
13,720 KB
testcase_29 AC 147 ms
14,184 KB
testcase_30 AC 130 ms
13,536 KB
testcase_31 AC 22 ms
8,504 KB
testcase_32 AC 83 ms
11,112 KB
testcase_33 AC 99 ms
12,184 KB
testcase_34 AC 47 ms
9,680 KB
testcase_35 AC 17 ms
7,752 KB
testcase_36 AC 30 ms
8,872 KB
testcase_37 AC 79 ms
10,988 KB
testcase_38 AC 171 ms
15,800 KB
testcase_39 AC 73 ms
10,644 KB
testcase_40 AC 18 ms
8,236 KB
testcase_41 AC 45 ms
9,468 KB
testcase_42 AC 23 ms
8,444 KB
testcase_43 AC 16 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
B = list(map(int,input().split()))
P = 998244353

power = [0] * N
i = 2
while i < N:
    for j in range(1,(N-1)//i + 1):
        power[i*j] += 1
    i *= 2
now = 0
count1 = 0
count2 = 0
S = 0
if B[0] == -1:
    count1 += 1
else:
    S += B[0]
if B[N-1] == -1:
    count1 += 1
else:
    S += B[N-1]
    
for i in range(1,N-1):
    now = now + power[N-i] - power[i]
    if now > 0:
        if B[i] == -1:count2 += 1
    else:
        if B[i] == -1:count1 += 1
        else:S += B[i]
if count1 == 0 and S % 2 == 0:
    print(0)
    exit()
if count1 == 0:u = count2
else:u = count1 + count2 -1

t = 1
for _ in range(u):
    t *= 2
    t %= P
print(t)
0