Submission #70410376


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] = nexts(2)
  const res = []
  for (let i = 0; i < n; i++) {
    if (i < m) {
      res.push('OK')
    }
    else {
      res.push('Too Many Requests')
    }
  }
  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 A - Too Many Requests
User xhksun
Language JavaScript (Node.js 18.16.1)
Score 100
Code Size 1663 Byte
Status AC
Exec Time 42 ms
Memory 42788 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 15
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt
Case Name Status Exec Time Memory
example_00.txt AC 41 ms 42716 KiB
example_01.txt AC 41 ms 42788 KiB
hand_00.txt AC 41 ms 42780 KiB
hand_01.txt AC 41 ms 42716 KiB
hand_02.txt AC 41 ms 42700 KiB
hand_03.txt AC 41 ms 42632 KiB
hand_04.txt AC 41 ms 42692 KiB
hand_05.txt AC 41 ms 42700 KiB
random_00.txt AC 41 ms 42780 KiB
random_01.txt AC 42 ms 42756 KiB
random_02.txt AC 41 ms 42520 KiB
random_03.txt AC 41 ms 42756 KiB
random_04.txt AC 41 ms 42728 KiB
random_05.txt AC 42 ms 42704 KiB
random_06.txt AC 41 ms 42736 KiB