Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
- const int N = 1e6 + 5;
- int a[N]; // static array
- signed main()
- {
- fastio;
- // Dynamic arrays
- /*
- vector<int> v; // {} <---
- //vector<int> v(3 , 5); // {5 , 5 , 5}
- v.push_back(5); // {5}
- v.push_back(3); // {5 , 3}
- cout << v.back() << '\n'; // en sagdaki element
- v.pop_back(); // en sagdakini sil
- v.clear(); // butun vektoru sil v.size() = 0
- cout << v.size(); // olcusu
- if(v.empty()) // eger bosdursa v.size() == 0
- */
- int n;
- cin >> n;
- vector<int> a(n);
- for(int i = 0; i < n; i++){
- cin >> a[i];
- }
- //sort(a + 0, a + n); // [0 , n - 1]
- sort(a.begin() , a.end()); // [begin() , end() - 1]
- reverse(a.begin() , a.end());
- cout << a[0] << ' ';
- cout << a.back() << '\n';
- //cout << *(a.begin() + i);
- for(int i = 0; i < a.size(); i++){
- cout << a[i] << ' ';
- }
- cout << '\n';
- for(int i : a){
- cout << i << ' ';
- }
- cout << '\n';
- // {5 , 3}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement