Skip to content

Instantly share code, notes, and snippets.

@Wikiko
Last active August 6, 2018 01:42
Show Gist options
  • Save Wikiko/18b311cdf4b2743c1693f1dfe855bb59 to your computer and use it in GitHub Desktop.
Save Wikiko/18b311cdf4b2743c1693f1dfe855bb59 to your computer and use it in GitHub Desktop.
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