MapleStory Finger Point

๐Ÿƒ‍โ™‚๏ธBaekjoon/Python

#10810 ๊ณต ๋„ฃ๊ธฐ - python

HYEJU01 2024. 4. 13. 02:55
N,M = map(int,input().split())
L=[]
a,b,c = 0,0,0

for a in range (N):
    L.append(0)

for b in range (M):
    i,j,k = map(int,input().split()) 
    for c in range (i-1,j): 
        L[c] = k

print(*L, sep=" ")

๋จผ์ € ๋ฐ”๊ตฌ๋‹ˆ N ๋ฒˆ์งธ ๊นŒ์ง€ 0์œผ๋กœ ์ฑ„์›Œ์ฃผ๊ณ  ์‹œ์ž‘ํ•œ๋‹ค.

์ดํ›„  i,j,k ๊ฐ’์„ ๋ฐ›์•„์˜จ๋‹ค.

 

ex) 1,4,3   // ๋ฐ”๊ตฌ๋‹ˆ 1๋ฒˆ์งธ ~ 4๋ฒˆ์งธ ๋œป์ธ๋ฐ

 

 โ•  ์‚ฌ์‹ค์ƒ 0๋ฒˆ์งธ ~ 3๋ฒˆ์งธ์ด๋‹ค.์ฆ‰ ๋ฐ˜๋ณต๋ฌธ ์‚ฌ์šฉ์‹œ

( i -1 ,  j  ) ๋กœ ๋„ฃ์–ด์ค˜์•ผํ•œ๋‹ค.

 

c๋Š” 0,1,2,3 ์ด ๋œ๋‹ค.

L [c]  ์ฐจ๋ก€๋Œ€๋กœ k ๊ฐ’์„ ๋„ฃ์–ด์ค€๋‹ค.

 

 

<< ์‚ฌ์šฉ๋œ ํ•จ์ˆ˜ >>

๐Ÿ”” map (์ ์šฉ์‹œํ‚ฌ ํ•จ์ˆ˜,  ์ ์šฉํ•  ๋ฐ˜๋ณต๊ฐ€๋Šฅํ•œ์ž๋ฃŒํ˜• ) :  ๊ฐ’์„ ์ผ๊ด„๋กœ ๋ณ€ํ™˜

๐Ÿ””  input().split()  : ๊ณต๋ฐฑ์„ ๊ธฐ์ค€์œผ๋กœ ๋ถ„๋ฆฌํ•˜์—ฌ ๊ฐ’์„ ๋ฐ›์Œ

๐Ÿ”” ๋ฆฌ์ŠคํŠธ๋ช….append() : ๋ฆฌ์ŠคํŠธ์— ๊ฐ’ ์ถ”๊ฐ€ํ•˜๊ธฐ

๐Ÿ”” print(*๋ฆฌ์ŠคํŠธ๋ช…, sep=" ")  : ๋ฆฌ์ŠคํŠธ ์ถœ๋ ฅ ์‹œ ๋Œ€๊ด„ํ˜ธ ์—†์ด ์ถœ๋ ฅํ•˜๋Š” ๋ฐฉ๋ฒ•.