結果

問題 No.2742 Car Flow
ユーザー PNJPNJ
提出日時 2024-04-21 00:13:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 119 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 113,280 KB
最終ジャッジ日時 2024-04-21 00:13:27
合計ジャッジ時間 5,647 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
112,512 KB
testcase_01 AC 98 ms
112,768 KB
testcase_02 AC 100 ms
113,024 KB
testcase_03 AC 99 ms
112,384 KB
testcase_04 AC 98 ms
113,280 KB
testcase_05 AC 100 ms
112,768 KB
testcase_06 AC 102 ms
113,024 KB
testcase_07 AC 96 ms
112,640 KB
testcase_08 AC 98 ms
112,896 KB
testcase_09 AC 96 ms
113,024 KB
testcase_10 AC 81 ms
97,280 KB
testcase_11 AC 86 ms
101,660 KB
testcase_12 AC 91 ms
92,928 KB
testcase_13 AC 73 ms
85,760 KB
testcase_14 AC 70 ms
83,840 KB
testcase_15 AC 50 ms
62,976 KB
testcase_16 AC 99 ms
113,024 KB
testcase_17 AC 97 ms
112,384 KB
testcase_18 AC 50 ms
63,232 KB
testcase_19 AC 95 ms
112,384 KB
testcase_20 AC 60 ms
74,624 KB
testcase_21 AC 57 ms
72,960 KB
testcase_22 AC 86 ms
101,248 KB
testcase_23 AC 94 ms
107,520 KB
testcase_24 AC 73 ms
85,888 KB
testcase_25 AC 119 ms
107,136 KB
testcase_26 AC 98 ms
112,640 KB
testcase_27 AC 66 ms
76,416 KB
testcase_28 AC 68 ms
80,640 KB
testcase_29 AC 50 ms
61,440 KB
testcase_30 AC 91 ms
106,496 KB
testcase_31 AC 64 ms
72,192 KB
testcase_32 AC 92 ms
106,624 KB
testcase_33 AC 90 ms
101,504 KB
testcase_34 AC 69 ms
80,384 KB
testcase_35 AC 60 ms
72,448 KB
testcase_36 AC 48 ms
61,184 KB
testcase_37 AC 63 ms
75,776 KB
testcase_38 AC 91 ms
101,632 KB
testcase_39 AC 55 ms
66,944 KB
testcase_40 AC 40 ms
51,968 KB
testcase_41 AC 40 ms
51,840 KB
testcase_42 AC 39 ms
51,712 KB
testcase_43 AC 43 ms
51,840 KB
testcase_44 AC 39 ms
51,968 KB
testcase_45 AC 39 ms
51,712 KB
testcase_46 AC 40 ms
51,968 KB
testcase_47 AC 40 ms
51,840 KB
testcase_48 AC 40 ms
52,096 KB
testcase_49 AC 39 ms
51,968 KB
testcase_50 AC 39 ms
51,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
one = sum(A)
zero = N - one
B = []
for i in range(min(one,zero)):
  B.append(0)
  B.append(1)
  one -= 1
  zero -= 1
for i in range(one):
  B.append(1)
for i in range(zero):
  B.append(0)

ans = 0
for i in range(N):
  if B[i] == 1 and B[(i-1) % N] == 0:
    ans += 1

mod = 998244353
ans *= pow(N,mod-2,mod)
ans %= mod
print(ans)
0