Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define pb push_back
- signed main()
- {/*
- int n;
- cin >> n;
- vector<int> a(n);
- for(int i = 0; i < n; i++)
- cin >> a[i];
- sort(a.begin() , a.end());
- for(int i = 0; i < a.size(); i++)
- cout << a[i] << " ";
- for(auto it = a.begin(); it != a.end(); it++)
- cout << *it << " ";
- for(int i : a)
- cout << i << " ";
- vector<int> v(5 , 7); // 7 7 7 7 7
- v.pb(8); // 7 7 7 7 7 8
- v.pb(1); // 7 7 7 7 7 8 1
- v.pb(9); // 7 7 7 7 7 8 1 9
- sort(v.begin() , v.end()); // 1 7 7 7 7 7 8 9
- v[5] = 6; // 1 7 7 7 7 6 8 9
- reverse(v.begin() , v.end()); // 9 8 6 7 7 7 7 1
- v[4] = 3; // 9 8 6 7 3 7 7 1
- sort(v.begin() , v.end()); // 1 3 6 7 7 7 8 9
- for(int i : v)
- cout << i << " ";
- cout << '\n';
- vector<int> v = {2 , 7 , 10};
- cout << v[0] << endl; // 2
- cout << v.front() << endl; // 2
- cout << *v.begin() << endl; // 2
- auto it = v.begin(); // vector<int>::iterator
- it++;
- cout << *it << endl; // 7
- it = v.end();
- it--;
- cout << *it << endl; // 10
- // 2 7 10
- int k = 2;
- it -= k;
- k--;
- it += k;
- k--;
- it += k;
- cout << *it << endl; // 7
- vector<int> v;
- if(v.empty())
- cout << "Yes" << endl;
- else
- cout << "No" << endl;
- vector<int> a(1 , 0);
- if(a.empty())
- cout << "Yes" << endl;
- else
- cout << "No" << endl;
- vector<int> v = {2 , 10 , 7 , 6};
- sort(v.rbegin() , v.rend()); // 10 7 6 2
- cout << v[1] << endl; // 7
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement