Skip to content

Commit

Permalink
Merge pull request #40 from AlgoLeadMe/10-rivkms
Browse files Browse the repository at this point in the history
10-rivkms
  • Loading branch information
tgyuuAn authored Jun 27, 2024
2 parents c98fcb4 + 11b7356 commit ef40fc8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rivkms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
| 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) |
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 ef40fc8

Please sign in to comment.