結果

問題 No.380 悪の台本
ユーザー nobigomunobigomu
提出日時 2018-09-05 13:19:48
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 20 ms / 1,000 ms
コード長 836 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-26 05:28:28
合計ジャッジ時間 956 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 4 ms
6,944 KB
testcase_05 AC 8 ms
6,940 KB
testcase_06 AC 8 ms
6,940 KB
testcase_07 AC 20 ms
6,940 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 4 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local D = {
	["petit "] = {"[Nn][Yy][Uu][^%w]*$"; 6; 9};
	["digi "] = {"[Nn][Yy][Oo][^%w]*$"; 6; 8};
	["rabi "] = 0;
	["gema "] = {"[Gg][Ee][Mm][Aa][^%w]*$"; 7; 9};
	["piyo "] = {"[Pp][Yy][Oo][^%w]*$"; 6; 8}
}
(function (f)
	local b=f()
	while b~=nil do print(b and "CORRECT (maybe)" or "WRONG!") b=f() end
end)(function ()
	local s=io.stdin:read("*l")
	if s==nil then return nil end
	if D[s:sub(1,5)]~=nil then
		if D[s:sub(1,5)]==0 then
			if s:sub(6):match("%w")==nil then return false end
		else
			if #s<D[s:sub(1,5)][3] then return false end
			if s:sub(-D[s:sub(1,5)][2]):match(D[s:sub(1,5)][1])==nil then return false end
		end
	elseif D[s:sub(1,6)]~=nil then
		if #s<D[s:sub(1,6)][3] then return false end
		if s:sub(-D[s:sub(1,6)][2]):match(D[s:sub(1,6)][1])==nil then return false end
	else return false end
	return true
end)
0