Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.023 s | 7 KBi |
#2 |
Correcto
|
0.055 s | 7 KBi |
#3 |
Correcto
|
0.019 s | 7 KBi |
#4 |
Correcto
|
0.055 s | 7 KBi |
#5 |
Correcto
|
0.024 s | 7 KBi |
#6 |
Correcto
|
0.023 s | 7 KBi |
#7 |
Correcto
|
0.029 s | 8 KBi |
#8 |
Correcto
|
0.079 s | 10 KBi |
#9 |
Correcto
|
0.031 s | 8 KBi |
#10 |
Correcto
|
0.024 s | 8 KBi |
const rl = require('readline').createInterface({ input: process.stdin }); let inputData = ''; (async () => { let myArray = []; let queriesNumber = 0; let lineReaded = 0; for await (const line of rl) { inputData += line + '\n'; } inputData = inputData.split('\n'); if (inputData.length && Number(inputData[0])) { lineReaded++; myArray = inputData[1].split(' ').map(Number); } lineReaded++; if (Number(inputData[2])) { queriesNumber = inputData[2]; } lineReaded++; for (let i = 0; i < queriesNumber; i++, lineReaded++) { console.log(countLargerNumbers(myArray, inputData[lineReaded])); } })(); function countLargerNumbers(myArray, num) { let counter = 0; for (i of myArray) { if (num < i) counter++; } return counter; }