結果

問題 No.630 門松グラフ
ユーザー 👑 obakyanobakyan
提出日時 2022-04-14 23:33:59
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 143 ms / 1,500 ms
コード長 628 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 00:03:33
合計ジャッジ時間 4,532 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 143 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 143 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 98 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 97 ms
4,376 KB
testcase_27 AC 98 ms
4,376 KB
testcase_28 AC 138 ms
4,376 KB
testcase_29 AC 120 ms
4,376 KB
testcase_30 AC 129 ms
4,380 KB
testcase_31 AC 113 ms
4,376 KB
testcase_32 AC 64 ms
4,380 KB
testcase_33 AC 54 ms
4,376 KB
testcase_34 AC 91 ms
4,380 KB
testcase_35 AC 63 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local n, m = io.read("*n", "*n")
local large = math.floor(n / 2)
local small = n - large
if m < n - 1 or small * large < m then
  print("NO") os.exit()
end
print("YES")
for i = 1, n do
  io.write(i)
  io.write(i == n and "\n" or " ")
end
for i = 1, small do
  if small + i <= n then
    print(i .. " " .. small + i)
  end
  if 1 < i then
    print(i .. " " .. small + i - 1)
  end
end
local rem = m - n + 1
for i = 1, small do
  if rem == 0 then break end
  for j = small + 1, n do
    if rem == 0 then break end
    if j ~= small + i and j ~= small + i - 1 then
      print(i .. " " .. j)
      rem = rem - 1
    end
  end
end
0