This commit is contained in:
Zengtudor 2024-10-25 20:05:13 +08:00
parent 87df2b11c0
commit a6bf42523b
3 changed files with 15 additions and 43222 deletions

View File

@ -19,12 +19,12 @@ std::ostream &operator<<(std::ostream &os, const std::array<T,S> &s){
os<<"array [ "; os<<"array [ ";
if(!s.empty()){ if(!s.empty()){
auto now_it = s.begin(); auto now_it = s.begin();
const auto rbegin = s.rbegin(); const auto back_1_it = s.end()-1;
while(*now_it!=*rbegin){ while(now_it!=back_1_it){
os<<*now_it<<", "; os<<*now_it<<", ";
++now_it; ++now_it;
} }
os<<*rbegin<<" ]"; os<<*back_1_it<<" ]";
}else{ }else{
os<<"}"; os<<"}";
} }
@ -36,12 +36,13 @@ std::ostream &operator<<(std::ostream &os, const std::set<T> &s){
os<<"set { "; os<<"set { ";
if(!s.empty()){ if(!s.empty()){
auto now_it = s.begin(); auto now_it = s.begin();
const auto rbegin = s.rbegin(); auto back_1_it = s.end();
while(*now_it!=*rbegin){ --back_1_it;
while(now_it!=back_1_it){
os<<*now_it<<", "; os<<*now_it<<", ";
++now_it; ++now_it;
} }
os<<*rbegin<<" }"; os<<*back_1_it<<" }";
}else{ }else{
os<<"}"; os<<"}";
} }

View File

@ -1,10 +1,11 @@
#include <functional> #include <iostream>
#include <queue> #include <random>
bool cmp(const int a,const int b){
return a>b;
}
int main(){ int main(){
std::priority_queue<int,std::deque<int>,std::less<int>> q; std::random_device rd;
std::mt19937 rng(rd());
std::uniform_int_distribution<int> ud(1,10);
for(int i{1};i<=10;i++){
std::cout<<ud(rng)<<'\n';
}
} }

43209
test.cpp

File diff suppressed because it is too large Load Diff