QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#769846#6602. Journey to Un'Gorodaylight-et-al#Compile Error//C++203.5kb2024-11-21 19:35:502024-11-21 19:35:50

Judging History

你现在查看的是最新测评结果

  • [2024-11-21 19:35:50]
  • 评测
  • [2024-11-21 19:35:50]
  • 提交

answer

#include <littlegirl/base>
void solve();
int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) solve();
    return 0;
}
ll dy[] = {0, 0, 1, 0, -1}, dx[] = {0, 1, 0, -1, 0};
// ll dy[8] = {1, 1, 0, -1, -1, -1, 0, 1}, dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
void solve() {
    vc<ll> ma = {0};
    rep(i, 1, 1e5 + 10) ma.push_back(ma.back() + (i + 1) / 2);
    ll n;
    cin >> n;
    if (n == 1) {
        cout << 1 << endl << "r" << endl;
        return;
    }
    auto calc = [&](string s) {
        ll res = 0;
        ll cur = 0;
        ll ec = 0, oc = 0;
        for (auto c : s) {
            if (cur == 0)
                ec++;
            else
                oc++;
            if (c == '0') {
                if (cur == 0)
                    res += oc;
                else
                    res += ec;
            } else {
                cur ^= 1;
                if (cur == 0)
                    res += oc;
                else
                    res += ec;
            }
        }
        return res;
    };
    if (n >= 300) {
        ll _n = n - n % 2;
        vc<string> res;
        string s = string(_n, '0');
        s[_n / 2] = '1';
        res.push_back(s);
        s[_n / 2] = '0', s[_n / 2 - 1] = '1';
        res.push_back(s);
        s[_n - 1] = '1';
        res.push_back(s);
        s[_n - 2] = '1';
        res.push_back(s);
        for (int i = _n - 3; i >= _n / 2; i--) {
            s[i] = '1', s[i + 2] = '0';
            res.push_back(s);
            if (res.size() == 100) break;
        }
        if (n % 2 == 1) {
            for (auto &x : res) {
                string x0 = x, x1 = x;
                x0.push_back('0');
                x1.push_back('1');
                if (calc(x0) > calc(x1))
                    x.push_back('0');
                else
                    x.push_back('1');
            }
        }
        cout << ma[n] << endl;
        for (auto x : res) {
            for (auto c : x) cout << (c == '0' ? 'b' : 'r');
            cout << endl;
        }
    } else {
        ll _n = n - n % 2;
        vc<string> res;
        res.push_back("01");
        res.push_back("10");
        res.push_back("11");
        for (int i = 4; i <= _n; i += 2) {
            vc<string> nres;
            for (auto x : res) {
                rep(j, 4) {
                    string tmp = "00";
                    if (j == 1) tmp = "01";
                    if (j == 2) tmp = "10";
                    if (j == 3) tmp = "11";
                    string nx = x + tmp;
                    if (calc(nx) == ma[i]) nres.push_back(nx);
                    nx = tmp + x;
                    if (calc(nx) == ma[i]) nres.push_back(nx);
                }
            }
            sort(all(nres));
            nres.erase(unique(all(nres)), nres.end());
            while (nres.size() > 100) nres.pop_back();
            res = nres;
        }
        if (n % 2 == 1) {
            for (auto &x : res) {
                string x0 = x, x1 = x;
                x0.push_back('0');
                x1.push_back('1');
                if (calc(x0) > calc(x1))
                    x.push_back('0');
                else
                    x.push_back('1');
            }
        }
        cout << ma[n] << endl;
        for (auto x : res) {
            for (auto c : x) cout << (c == '0' ? 'b' : 'r');
            cout << endl;
        }
    }
}

Details

answer.code:1:10: fatal error: littlegirl/base: No such file or directory
    1 | #include <littlegirl/base>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.