結果

問題 No.146 試験監督(1)
ユーザー 826814741_6826814741_6
提出日時 2018-12-27 00:54:38
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 47 ms / 1,000 ms
コード長 369 bytes
コンパイル時間 43 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 6,952 KB
最終ジャッジ日時 2024-04-09 03:01:02
合計ジャッジ時間 1,353 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
6,816 KB
testcase_01 AC 46 ms
6,948 KB
testcase_02 AC 47 ms
6,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

print((function (f)
	return tostring(f(1000000007LL,io.stdin:read("*n"))):sub(1,-3)
end)(function (m, n)
	local ffi = require'ffi'
	local C,ct = ffi.C,ffi.typeof("long[1]")
	ffi.cdef 'int scanf(const char *, ...);'
	local r,c,d = 0LL,ct(),ct()
	for _=1,n do
		C.scanf("%ld%ld",c,d)
		r=r+(((c[0]/2LL+(c[0]%2LL~=0LL and 1LL or 0LL))%m)*(d[0]%m))%m
	end
	return r%m
end))
0