[Python] ๋ฐฑ์ค€ 2420 - ์‚ฌํŒŒ๋ฆฌ์›”๋“œ
ยท
Algorithm
๋ฌธ์ œ ์‚ฌํŒŒ๋ฆฌ์›”๋“œ๋Š” ์ธํ„ฐ๋„ท์œผ๋กœ๋งŒ ์กด์žฌํ•˜๋Š” ๋ฏธ์Šคํ…Œ๋ฆฌํ•œ ๋‚˜๋ผ์ด๋‹ค. ์‚ฌํŒŒ๋ฆฌ์›”๋“œ์—๋Š” 2๊ฐœ์˜ ์„œ๋ธŒ๋„๋ฉ”์ธ์ด seunghwan.royal.gov.sw์™€ kyuhyun.royal.gov.sw ์ด ์žˆ๋Š”๋ฐ, ์ด๊ฒƒ์ด couple.royal.gov.sw์œผ๋กœ ํ•ฉ์ณ์งˆ ๊ฒƒ์ด๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๋„๋ฉ”์ธ ๊ด€๋ฆฌ ์„ผํ„ฐ SWNIC(์„ผํ„ฐ์žฅ: ๊น€๋™๊ทœ)์—๋Š” ์—„๊ฒฉํ•œ ๋ฃฐ์ด ์žˆ๋‹ค. ๋‘ ์„œ๋ธŒ๋„๋ฉ”์ธ์„ ํ•ฉ์น  ๋•Œ, ์œ ๋ช…๋„์˜ ์ฐจ์ด๊ฐ€ ๋„ˆ๋ฌด ์ฐจ์ด๋‚˜์ง€ ์•Š์„ ๊ฒฝ์šฐ์—๋งŒ ๋‘ ์„œ๋ธŒ๋„๋ฉ”์ธ์„ ๊ฒฐํ˜ผ์‹œํ‚ค๋Š” ๊ฒƒ์ด๋‹ค. ์„œ๋ธŒ๋„๋ฉ”์ธ์˜ ์œ ๋ช…๋„๋Š” ์ •์ˆ˜์ด๋‹ค. ๋‘ ์„œ๋ธŒ๋„๋ฉ”์ธ์˜ ์œ ๋ช…๋„๊ฐ€ ์ฃผ์–ด์กŒ์„ ๋•Œ, ๊ทธ ์ฐจ์ด๋ฅผ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ์ž…๋ ฅ ์ฒซ์งธ ์ค„์— ๋‘ ๋„๋ฉ”์ธ์˜ ์œ ๋ช…๋„ N๊ณผ M์ด ์ฃผ์–ด์ง„๋‹ค. (-2,000,000,000 ≤ N, M ≤ 2,000,000,000) ์ถœ๋ ฅ ์ฒซ์งธ ์ค„์— ๋‘ ์œ ๋ช…๋„์˜ ์ฐจ์ด (..