https://www.acmicpc.net/problem/10815

 

10815번: 숫자 카드

첫째 줄에 상근이가 가지고 있는 숫자 카드의 개수 N(1 ≤ N ≤ 500,000)이 주어진다. 둘째 줄에는 숫자 카드에 적혀있는 정수가 주어진다. 숫자 카드에 적혀있는 수는 -10,000,000보다 크거나 같고, 10,

www.acmicpc.net

const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split("\n");
const dic = {};
const N = Number(input[0]);
const M = Number(input[2]);
const sang = input[1].split(" ");
const comp = input[3].split(" ");
const answer = [];


sang.forEach(c => {
    dic[c] = 0;
});

comp.forEach((d) => {
    if(dic[d] !== undefined ) answer.push(1);
    else answer.push(0);
})

console.log(answer.join(" "));
728x90

+ Recent posts