diff --git a/rivkms/README.md b/rivkms/README.md index 24b6cef..bec8994 100644 --- a/rivkms/README.md +++ b/rivkms/README.md @@ -10,4 +10,5 @@ | 6차시 | 2024.02.27 | BFS | [토마토](https://www.acmicpc.net/problem/7576) | [#6](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/20) | | 7차시 | 2024.03.01 | DP | [연속합](https://www.acmicpc.net/problem/1912) | [#7](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/25) | | 8차시 | 2024.03.01 | Greedy | [회의실 배정](https://www.acmicpc.net/problem/1931) | [#8](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/28) | -| 9차시 | 2024.03.22 | two-pointer | [두 수의 합](https://www.acmicpc.net/problem/3273) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/38) | \ No newline at end of file +| 9차시 | 2024.03.22 | two-pointer | [두 수의 합](https://www.acmicpc.net/problem/3273) | [#9](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/38) | +| 10차시 | 2024.03.28 | queue | [최대힙](https://www.acmicpc.net/problem/11279) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/40) | diff --git a/rivkms/queue/11279.cpp b/rivkms/queue/11279.cpp new file mode 100644 index 0000000..3b1eae7 --- /dev/null +++ b/rivkms/queue/11279.cpp @@ -0,0 +1,34 @@ +#include +#include + +using namespace std; + + + +int main(){ + ios_base::sync_with_stdio(false); + cin.tie(NULL); + cout.tie(NULL); + + int n, tmp; + cin >> n; + + priority_queue q; + vector printq; + for(int i = 0; i < n; i++){ + cin >> tmp; + if(tmp == 0){ + if(q.empty()){ + cout << 0 << "\n"; + } + else{ + cout << q.top() << "\n"; + q.pop(); + } + } + else{ + q.push(tmp); + } + } + return 0; +} \ No newline at end of file