Skip to content

Commit

Permalink
Merge pull request #164 from AlgoLeadMe/6-H0ngJu
Browse files Browse the repository at this point in the history
6-H0ngJu
  • Loading branch information
H0ngJu authored Mar 27, 2024
2 parents 4b04141 + cb2cfd9 commit b06f1cb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions H0ngJu/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
| 3μ°¨μ‹œ | 2024.03.10 | νž™ | [N번째 큰 수](https://www.acmicpc.net/problem/2075) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/156 |
| 4μ°¨μ‹œ | 2024.03.13 | νž™ | [λ¬Έμ œμ§‘](https://www.acmicpc.net/problem/1766) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/158 |
| 5μ°¨μ‹œ | 2024.03.16 | κ΅¬ν˜„ | [μš”μ„Έν‘ΈμŠ€ 문제](https://www.acmicpc.net/problem/1158) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/161 |
| 6μ°¨μ‹œ | 2024.03.19 | μŠ€νƒ | [였큰수](https://www.acmicpc.net/problem/17298) | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/164 |

---
25 changes: 25 additions & 0 deletions H0ngJu/였큰수.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import sys
from collections import *

def input(): return sys.stdin.readline().strip()
N = int(input())

arr = list(map(int, input().split()))
arr.reverse()
answer = [-1 for _ in range(N)]

id = 0

stack = []
stack.append((id,arr.pop()))

while arr:
id += 1
arr_data = arr.pop()
while stack and stack[-1][1] < arr_data:
index, data = stack.pop()
answer[index] = arr_data
stack.append((id, arr_data))

for i in answer:
print(i, end=" ")

0 comments on commit b06f1cb

Please sign in to comment.