Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cmath>
- #include <ctime>
- #include <iostream>
- #include <vector>
- using std::cin;
- using std::cout;
- using std::max;
- using std::min;
- using std::string;
- using std::vector;
- using std::swap;
- vector<int> srt5(vector<int> vv) {
- for (int ii = 0; ii < 5; ++ii) {
- for (int jj = 0; jj < 4; ++jj) {
- if (vv[jj] > vv[jj + 1]) {
- swap(vv[jj], vv[jj + 1]);
- }
- }
- }
- return vv;
- }
- vector<int> getB(vector<int> aa) {
- vector<int> bb;
- for (int ii = 0; ii < aa.size(); ++ii) {
- vector <int> vv = {aa[ii], aa[ii + 1], aa[ii + 2], aa[ii + 3], aa[ii + 4]};
- vv = srt5(vv);
- bb.push_back(vv[2]);
- }
- return bb;
- }
- vector<int> Partition(vector<int> aa) {
- int nn = aa.size();
- if (nn <= 1) {
- return aa;
- }
- int piv = DQS(aa);
- vector<int> bb;
- vector<int> cc;
- for (int ii = 0; ii < nn; ++ii) {
- if (aa[ii] >= piv) {
- cc.push_back(aa[ii]);
- } else {
- bb.push_back(aa[ii]);
- }
- }
- bb = F(bb);
- cc = F(cc);
- vector<int> dd;
- for (int ii : bb) {
- dd.push_back(ii);
- }
- for (int ii : cc) {
- dd.push_back(ii);
- }
- return dd;
- }
- int main() {
- /*std::ios::sync_with_stdio(false);
- std::cin.tie(0);
- std::cout.tie(0);*/
- int inf = 2e9;
- int nn;
- cin >> nn;
- vector<int> aa(nn);
- for (int& ii : aa) {
- cin >> ii;
- }
- while (a.size() % 5 != 0) {
- aa.push_back(inf);
- }
- aa = F(aa);
- for (int ii : aa) {
- cout << ii << ' ';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement