Submission #70777910


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 [n, m, k] = nexts(3)
  const h = nexts(n)
  const b = nexts(m)
  h.sort((a, b) => a - b)
  b.sort((a, b) => a - b)
  let i = 0
  let j = 0
  let cnt = 0
  while (j < m) {
    if (h[i] <= b[j]) {
      i++
      j++
      cnt++
      if (cnt >= k) {
        return 'Yes'
      }
    }
    else {
      j++
    }
  }
  return 'No'
}
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 C - Robot Factory
User xhksun
Language JavaScript (Node.js 22.19.0)
Score 300
Code Size 1811 Byte
Status AC
Exec Time 230 ms
Memory 97912 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 35
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.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, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 46 ms 42104 KiB
00_sample_01.txt AC 23 ms 42076 KiB
00_sample_02.txt AC 23 ms 42072 KiB
00_sample_03.txt AC 23 ms 42116 KiB
01_random_03.txt AC 230 ms 97564 KiB
01_random_04.txt AC 203 ms 97560 KiB
01_random_05.txt AC 202 ms 97760 KiB
01_random_06.txt AC 203 ms 97576 KiB
01_random_07.txt AC 203 ms 97532 KiB
01_random_08.txt AC 204 ms 97776 KiB
01_random_09.txt AC 203 ms 97480 KiB
01_random_10.txt AC 204 ms 97440 KiB
01_random_11.txt AC 203 ms 97644 KiB
01_random_12.txt AC 106 ms 70716 KiB
01_random_13.txt AC 110 ms 72536 KiB
01_random_14.txt AC 140 ms 78816 KiB
01_random_15.txt AC 76 ms 60888 KiB
01_random_16.txt AC 70 ms 60636 KiB
01_random_17.txt AC 79 ms 60620 KiB
01_random_18.txt AC 203 ms 97664 KiB
01_random_19.txt AC 204 ms 97496 KiB
01_random_20.txt AC 204 ms 97912 KiB
01_random_21.txt AC 204 ms 97560 KiB
01_random_22.txt AC 205 ms 97396 KiB
01_random_23.txt AC 108 ms 71920 KiB
01_random_24.txt AC 31 ms 50268 KiB
01_random_25.txt AC 193 ms 94468 KiB
01_random_26.txt AC 204 ms 97384 KiB
01_random_27.txt AC 204 ms 97500 KiB
01_random_28.txt AC 204 ms 97580 KiB
01_random_29.txt AC 204 ms 97628 KiB
01_random_30.txt AC 203 ms 97636 KiB
01_random_31.txt AC 136 ms 77768 KiB
01_random_32.txt AC 150 ms 79768 KiB
01_random_33.txt AC 147 ms 78952 KiB