Skip to content

Commit

Permalink
2024-03-28 최대힙
Browse files Browse the repository at this point in the history
  • Loading branch information
rivkms committed Mar 28, 2024
1 parent 8e78c88 commit 7510e57
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rivkms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
| 5차시 | 2024.02.24 | Backtracking | [입대](https://www.acmicpc.net/problem/31413) | [#5](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/18) |
| 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) |
| 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) |
| 10차시 | 2024.03.28 | queue | [최대힙](https://www.acmicpc.net/problem/11279) | [#10](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/38) |
34 changes: 34 additions & 0 deletions rivkms/queue/11279.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <iostream>
#include <queue>

using namespace std;



int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);

int n, tmp;
cin >> n;

priority_queue<int> q;
vector<int> 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;
}

0 comments on commit 7510e57

Please sign in to comment.