Submission #74653224


Source Code Expand

function main(stdin) {
  // eslint-disable-next-line unused-imports/no-unused-vars, no-unused-vars
  const { next, nextstr, nextbig, nexts, nextssort, nextm, xArray } = makeInputReader(stdin)
  const [h, w] = nexts(2)
  const map = Array.from({ length: h }, () => Array.from({ length: w }, () => '.'))
  for (let i = 0; i < h; i++) {
    for (let j = 0; j < w; j++) {
      if (i === 0 || i === h - 1) {
        map[i][j] = '#'
      }
      if (j === 0 || j === w - 1) {
        map[i][j] = '#'
      }
    }
  }
  const res = []
  for (let i = 0; i < map.length; i++) {
    res.push(map[i].join(''))
  }
  return res.join('\n')
}
function makeInputReader(input) {
  const cin = input.trim().split(/ |\n/)
  let cid = 0
  function createNDArray(shape, fillFn) {
    if (shape.length === 0)
      return fillFn()
    const [dim, ...rest] = shape
    return Array.from({ length: dim }, () => createNDArray(rest, fillFn))
  }
  return {
    next: () => Number(cin[cid++]),
    nextstr: () => cin[cid++],
    nextbig: () => BigInt(cin[cid++]),
    nexts: (n, addNum = 0, parse = true) =>
      parse ? cin.slice(cid, cid += n).map(s => Number(s) + addNum) : cin.slice(cid, cid += n),
    nextssort: (n, parse = true, desc = false) =>
      parse
        ? cin.slice(cid, cid += n).map(Number).sort((a, b) => desc ? b - a : a - b)
        : cin.slice(cid, cid += n).sort((a, b) => desc ? b.localeCompare(a) : a.localeCompare(b)),
    nextm: (h, w, parse = true) => {
      const res = []
      for (let i = 0; i < h; i++) {
        const row = cin.slice(cid, cid += w)
        res.push(parse ? row.map(Number) : row)
      }
      return res
    },
    xArray: createNDArray,
  }
}
if (require.main === module) {
  const fs = require('node:fs')
  const input = fs.readFileSync('/dev/stdin', 'utf8')
  console.log(main(input))
}
module.exports = { main }

Submission Info

Submission Time
Task B - Draw Frame
User xhksun
Language JavaScript (Node.js 22.19.0)
Score 200
Code Size 1907 Byte
Status AC
Exec Time 40 ms
Memory 42200 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 14
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 40 ms 42048 KiB
00_sample_01.txt AC 26 ms 42184 KiB
01_random_02.txt AC 26 ms 42060 KiB
01_random_03.txt AC 26 ms 42112 KiB
01_random_04.txt AC 26 ms 42112 KiB
01_random_05.txt AC 25 ms 42112 KiB
01_random_06.txt AC 26 ms 42060 KiB
01_random_07.txt AC 26 ms 42068 KiB
01_random_08.txt AC 26 ms 42064 KiB
01_random_09.txt AC 26 ms 42112 KiB
01_random_10.txt AC 26 ms 42072 KiB
01_random_11.txt AC 26 ms 42200 KiB
01_random_12.txt AC 25 ms 42060 KiB
01_random_13.txt AC 26 ms 42048 KiB