結果

問題 No.647 明太子
ユーザー nobigomu
提出日時 2018-05-01 12:35:00
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 91 ms / 4,500 ms
コード長 519 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 00:05:38
合計ジャッジ時間 1,202 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

local ffi = require 'ffi'
local C = ffi.C
ffi.cdef 'int scanf(const char *, ...);'

do
local st,pt=ffi.typeof("int32_t[2]"),ffi.typeof("int32_t[1]")

local a,t,u,n={},pt(),pt(),io.stdin:read("*n")
for i=1,n do C.scanf("%d %d",t,u) a[i]=st(t[0],u[0]) end

local b,k,m={},0,io.stdin:read("*n")
for i=1,m do
	b[i]=0 C.scanf("%d %d",t,u)
	for j=1,n do if t[0]<=a[j][0] and u[0]>=a[j][1] then b[i]=b[i]+1 end end
	if b[i]>k then k=b[i] end
end
if k==0 then print(0) else for i=1,m do if k==b[i] then print(i) end end end
end
0