1_Makar's blog

By 1_Makar, history, 2 hours ago, In Russian

Я фанат великого человека — Ишоря Конспектенко Хлебцовича Mudrenko_2010, одного из создателей чикенгана. Его искусство писать конспекты бесподобно. Так же Ишорь в течении октября выучил слова такие как "коч братан", "рофл", "что ты лысый плаки плаки или нормалдаки". Он становится очень злым, когда он получает всего лишь 9 по английскому языку. Он любит писать разбор случаев на 180 строк кода #pragma GCC optimize("O3,unroll-loops")

include <bits/stdc++.h>

include <ext/pb_ds/tree_policy.hpp>

include <ext/pb_ds/assoc_container.hpp>

define int long long

define ll long long

define ld long double

define vi vector

define S second

define F first

define pb push_back

define all(x) x.begin(), x.end()

define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

define forn(i, n) for (int i = 0; i < n; ++i)

define pii pair <int, int>

using namespace std; using namespace __gnu_pbds; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef tree< int, null_type, less < int >, rb_tree_tag, tree_order_statistics_node_update > oset; void solve() { int n; cin >> n; vector <pair<string,string>> s(n); for (int i = 0; i < n; ++i) cin >> s[i].F >> s[i].S; bool f1 = false, f2 = false, f3 = false, f4 = false; for (const auto &[f, ss]: s) { if (f == "ABC") f1 = true; else if (f == "A") f2 = true; else if (f == "B") f3 = true; else if (f == "C") f4 = true; } if (f1 && f2 && f3 && f4) { cout << "Impossible"; return; } if (!f1) { for (auto to : s) if (to.first == "A") cout << to.first << ' ' << to.second << '\n'; for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n'; for (auto to : s) if (to.first == "B") cout << to.first << ' ' << to.second << '\n'; for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n'; for (auto to : s) if (to.first == "C") cout << to.first << ' ' << to.second << '\n'; return; } if (f3 && f4 && !f2) { // cout << "!";

for (auto to : s) if (to.first == "B") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "C") cout << to.first << ' ' << to.second << '\n';
    return;
}
if (f2 && !f3 && f4) {
    for (auto to : s) if (to.first == "A") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "A") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "C") cout << to.first << ' ' << to.second << '\n';
    return;
}
if (f2 && f3 && !f4) {//cout << "!";
    for (auto to : s) if (to.first == "A") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "B") cout << to.first << ' ' << to.second << '\n';
    return;
}
if (f3 && !f2 && !f4) {


    for (auto to : s) if (to.first == "B") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n';for (auto to : s) if (to.first == "AC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';

    return;
}
if (!f3 && f2 && f4) {
    for (auto to : s) if (to.first == "A") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "C") cout << to.first << ' ' << to.second << '\n';
    return;
}
if (f3 && f2 && !f4) {
    for (auto to : s) if (to.first == "A") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "B") cout << to.first << ' ' << to.second << '\n';
    return;
}
if (!f2 && !f3 && !f4) {
    for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    return;
}
if (f2 && !f3 && !f4) {
    for (auto to : s) if (to.first == "A") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    return;
}
if (f3 && !f2 && !f4) {
    for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "B") cout << to.first << ' ' << to.second << '\n';
    return;
}
if (f4 && !f2 && !f3) {
    for (auto to : s) if (to.first == "AB") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "ABC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "BC") cout << to.first << ' ' << to.second << '\n';
    for (auto to : s) if (to.first == "C") cout << to.first << ' ' << to.second << '\n';
    return;
}
sort(all(s));
for (const auto &[f, ss]: s) cout << f << ' ' << ss << '\n';

}

int32_t main() {

// freopen("b.in", "r", stdin); // freopen("b.out", "w", stdout); fast_io int t = 1; //cin >> t; while (t--) solve(); return 0; }. Он очень любит играть в чикенган.

  • Vote: I like it
  • +4
  • Vote: I do not like it