結果
問題 | No.1646 Avoid Palindrome |
ユーザー |
👑 |
提出日時 | 2021-08-13 21:38:21 |
言語 | Lua (LuaJit 2.1.1734355927) |
結果 |
WA
|
実行時間 | - |
コード長 | 755 bytes |
コンパイル時間 | 247 ms |
コンパイル使用メモリ | 6,820 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-03 17:50:39 |
合計ジャッジ時間 | 1,479 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 7 WA * 33 |
ソースコード
local mod = 998244353local mfl = math.floorlocal function bmul(x, y)local x0, y0 = x % 31596, y % 31596local x1, y1 = mfl(x / 31596), mfl(y / 31596)return (x1 * y1 * 62863 + (x1 * y0 + x0 * y1) * 31596 + x0 * y0) % modendlocal n = io.read("*n", "*l")local s = io.read()local t = {}for i = 1, n dot[i] = s:sub(i, i)endfor i = 1, n - 1 doif t[i] == t[i + 1] and t[i] ~= "?" thenprint(0) os.exit()endendfor i = 1, n - 2 doif t[i] == t[i + 2] and t[i] ~= "?" thenprint(0) os.exit()endendlocal ret = 1for i = 1, n doif i == 1 thenif t[i] == "?" then ret = 26 endelseif i == 2 thenif t[i] == "?" then ret = ret * 25 endelseif t[i] == "?" then ret = bmul(ret, 24) endendendprint(ret)