Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <vector>
- #include <iostream>
- #include <algorithm>
- #include <cmath>
- #include <string>
- #include <set>
- #include <map>
- #include <list>
- using namespace std;
- #define re return
- #define pb push_back
- #define eb emplace_back
- #define all(x) (x).begin(), (x).end()
- #define fi first
- #define se second
- #define sqrt(x) sqrt(abs(x))
- #define pi (3.14159265358979323846264338327950288419716939937510)
- #define unique(v) v.resize(unique(all(v)) - v.begin())
- #define bipbup ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
- typedef vector<int> vi;
- typedef vector<vi> vvi;
- typedef pair<int, int> ii;
- typedef vector<ii> vii;
- typedef vector<string> vs;
- typedef double D;
- typedef long double ld;
- typedef long long ll;
- typedef pair<ll, ll> pll;
- typedef vector<ll> vll;
- typedef unsigned long long ull;
- int main()
- {
- list <string> l;
- string s, trash;
- int k;
- cin >> k;
- getline(cin, trash);
- for (int i = 0; i < k; ++i)
- {
- //cin >> s;
- getline(cin, s);
- l.push_back(s);
- }
- /*list <string> ::iterator it(l.begin());
- for (it; it != l.end(); ++it)
- cout << *it << '\n';*/
- int n;
- cin >> n;
- getline(cin, trash);
- for (int i = 0; i < n; ++i)
- {
- bool f(1);
- getline(cin, s);
- list <string>::iterator it(l.begin());
- for (it; it != l.end(); ++it)
- {
- if (!(s > * it))
- {
- f = 0;
- l.insert(it, s);
- break;
- }
- }
- if (f)
- l.push_back(s);
- }
- cout << "\n\n";
- list <string> ::iterator it(l.begin());
- for (it; it != l.end(); ++it)
- cout << *it << '\n';
- re 0;
- }
- /**
- 5
- Gore ot yma
- Otci I deti
- Repka
- Revizor
- Voina I mir
- 3
- Mertvie dyshi
- Prestyplenie I nakazanie
- Tri tovarisha
- **/
Add Comment
Please, Sign In to add comment