Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <algorithm>
- #include <iostream>
- #include <vector>
- #include <random>
- using namespace std;
- int main(){
- const size_t N = 5000;
- vector<int> tab(N);
- random_device rd;
- mt19937_64 gen(rd());
- uniform_int_distribution<int> dist;
- generate(begin(tab),end(tab), [&](){return dist(gen);} );
- for (auto &a: tab)
- for (auto &b: tab)
- if (a < b) swap(a,b);
- if (is_sorted(begin(tab), end(tab)))
- cout<<"sorted\n";
- else cout<<"blah\n";
- }
Add Comment
Please, Sign In to add comment