結果

問題 No.723 2つの数の和
ユーザー 826814741_6826814741_6
提出日時 2019-01-06 01:20:35
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 384 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 5,368 KB
実行使用メモリ 5,084 KB
最終ジャッジ日時 2023-08-15 15:57:45
合計ジャッジ時間 1,508 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 19 ms
4,984 KB
testcase_04 AC 20 ms
4,988 KB
testcase_05 AC 19 ms
5,004 KB
testcase_06 AC 21 ms
5,056 KB
testcase_07 AC 11 ms
4,376 KB
testcase_08 AC 15 ms
4,576 KB
testcase_09 AC 22 ms
5,084 KB
testcase_10 AC 12 ms
4,376 KB
testcase_11 AC 3 ms
4,376 KB
testcase_12 AC 15 ms
4,604 KB
testcase_13 AC 22 ms
5,004 KB
testcase_14 AC 7 ms
4,380 KB
testcase_15 AC 12 ms
4,568 KB
testcase_16 AC 14 ms
4,536 KB
testcase_17 AC 19 ms
5,036 KB
testcase_18 AC 10 ms
4,376 KB
testcase_19 AC 14 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 14 ms
4,380 KB
testcase_24 AC 9 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

print((function (f)
	local a,h,r,n,x={},{},0,f(),f()
	for i=1,n do a[i]=f() end
	for i=1,n do if h[a[i]]==nil then h[a[i]]=0 end h[a[i]]=h[a[i]]+1 end
	for i=1,n do if h[x-a[i]]~=nil then r=r+h[x-a[i]] end end
	return r
end)((function (M)
	M.cdef 'int scanf(const char *, ...);'
	local C,c = M.C,M.new("int[1]")
	return function () C.scanf("%d",c) return c[0] end
end)(require'ffi')))
0