문제 13549번: 숨바꼭질 3 수빈이는 동생과 숨바꼭질을 하고 있다. 수빈이는 현재 점 N(0 ≤ N ≤ 100,000)에 있고, 동생은 점 K(0 ≤ K ≤ 100,000)에 있다. 수빈이는 걷거나 순간이동을 할 수 있다. 만약, 수빈이의 위치가 X일 www.acmicpc.net 소스 코드 const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; const input = require('fs') .readFileSync(filePath) .toString() .trim() .split('\n'); const [N, K] = input[0].split(' ').map(Number); const MAX_SIZE = 1000..
문제 13023번: ABCDE 문제의 조건에 맞는 A, B, C, D, E가 존재하면 1을 없으면 0을 출력한다. www.acmicpc.net 소스 코드 const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt'; const input = require('fs') .readFileSync(filePath) .toString() .trim() .split('\n'); const [N, M] = input[0].split(' ').map(Number); const graph = []; for (let i = 0; i < N; i++) graph[i] = []; for (let i = 1; i = 5) { flag = true; r..
문제 17836번: 공주님을 구해라! 용사는 마왕이 숨겨놓은 공주님을 구하기 위해 (N, M) 크기의 성 입구 (1,1)으로 들어왔다. 마왕은 용사가 공주를 찾지 못하도록 성의 여러 군데 마법 벽을 세워놓았다. 용사는 현재의 가지고 있는 www.acmicpc.net 소스 코드 class Queue { constructor() { this.dat = []; this.head = 0; this.tail = 0; } push(item) { this.dat[this.tail++] = item; } pop() { this.head++; } front() { return this.dat[this.head]; } rear() { return this.dat[this.tail - 1]; } isEmpty() { ret..