Last active
August 6, 2018 01:42
-
-
Save Wikiko/18b311cdf4b2743c1693f1dfe855bb59 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function processData(input) { | |
const splitedInput = input.split('\n'); | |
let currentIndex = -1; | |
const qtdOfBlackList = parseInt(head(splitedInput)); | |
currentIndex = 0; | |
const blackList = splitedInput.slice(currentIndex + 1, qtdOfBlackList + 1); | |
currentIndex += qtdOfBlackList + 1; | |
const restOfInput = splitedInput.slice(currentIndex); | |
currentIndex = 0; | |
const qtdOfGeneralList = parseInt(head(restOfInput)); | |
const generalList = restOfInput.slice(currentIndex + 1, qtdOfGeneralList + 1); | |
const result = generalList.map(number => { | |
if(blackList.includes(number)){ | |
return 'NOK'; | |
} | |
return 'OK'; | |
}); | |
console.log(result.join('\n')); | |
} | |
const head = list => list[0]; | |
process.stdin.resume(); | |
process.stdin.setEncoding("ascii"); | |
_input = ""; | |
process.stdin.on("data", function (input) { | |
_input += input; | |
}); | |
process.stdin.on("end", function () { | |
processData(_input); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment