Skip to content

Instantly share code, notes, and snippets.

@rubentd
Last active October 16, 2019 21:10
Show Gist options
  • Save rubentd/130ad40c04fb5971ce82e4eae25e1e15 to your computer and use it in GitHub Desktop.
Save rubentd/130ad40c04fb5971ce82e4eae25e1e15 to your computer and use it in GitHub Desktop.
const fs = require('fs');
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '';
let currentLine = 0;
process.stdin.on('data', inputStdin => {
inputString += inputStdin;
});
process.stdin.on('end', _ => {
inputString = inputString.replace(/\s*$/, '')
.split('\n')
.map(str => str.replace(/\s*$/, ''));
main();
});
function readLine() {
return inputString[currentLine++];
}
// Complete the matrixSearch function below.
function matrixSearch(G, P) {
}
function main() {
const ws = fs.createWriteStream('./sample.out');
const t = parseInt(readLine(), 10);
for (let tItr = 0; tItr < t; tItr++) {
const RC = readLine().split(' ');
const R = parseInt(RC[0], 10);
let G = [];
for (let i = 0; i < R; i++) {
const GItem = readLine();
G.push(GItem);
}
const rc = readLine().split(' ');
const r = parseInt(rc[0], 10);
let P = [];
for (let i = 0; i < r; i++) {
const PItem = readLine();
P.push(PItem);
}
let result = matrixSearch(G, P);
ws.write(result + "\n");
}
ws.end();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment