結果
問題 | No.2356 Back Door Tour in Four Seasons |
ユーザー | minimum |
提出日時 | 2023-06-16 22:04:39 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 372 bytes |
コンパイル時間 | 522 ms |
コンパイル使用メモリ | 87,104 KB |
実行使用メモリ | 71,500 KB |
最終ジャッジ日時 | 2023-09-06 19:54:29 |
合計ジャッジ時間 | 4,915 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 62 ms
71,420 KB |
testcase_01 | AC | 63 ms
71,132 KB |
testcase_02 | AC | 62 ms
71,500 KB |
testcase_03 | AC | 63 ms
71,368 KB |
testcase_04 | TLE | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
ソースコード
MOD = 998244353 N = int(input()) ls = [0, 0, 0, 0] S = "UFWP" suma = 0 C = ((N - 2) * pow(N - 1, -1, MOD)) % MOD cnt = 0 for i in range(N): s, a = input().split(' ') a = int(a) ls[S.find(s)] += (1 - pow(C, a)) ls[S.find(s)] %= MOD suma += a if s == 'P': cnt += 1 ans = (ls[0] * ls[1] * ls[2] * cnt * pow(N - 1, suma, MOD)) % MOD print(ans)