-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1920-number.js
More file actions
39 lines (36 loc) ยท 957 Bytes
/
1920-number.js
File metadata and controls
39 lines (36 loc) ยท 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// {๋ฌธ์ }
// N๊ฐ์ ์ ์ A[1], A[2], โฆ, A[N]์ด ์ฃผ์ด์ ธ ์์ ๋, ์ด ์์ X๋ผ๋ ์ ์๊ฐ ์กด์ฌํ๋์ง ์์๋ด๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ์์ค.
// [์ฝ๋]
const readline = require("readline");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
const input = Array.from({ length: 100001 }, () => 0);
arr = [];
let num = 0;
rl.on("line", function (line) {
num += 1;
if (num % 2 == 1) {
return;
} else if (num % 2 == 0) {
arr.push(line);
}
}).on("close", function () {
const number1 = arr[0].split(" ");
const number2 = arr[1].split(" ");
const numberArray = [];
for (let i = 0; i < number1.length; i++) {
input[number1[i]] = 1;
}
for (let j = 0; j < number2.length; j++) {
if (input[number2[j]] == 1) {
numberArray[j] = 1;
} else {
numberArray[j] = 0;
}
}
let ar = numberArray.join("\n");
console.log(ar);
process.exit();
});