QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#77720#5507. InvestorslycheesCompile Error//C++231.7kb2023-02-15 15:19:132023-02-15 15:19:14

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-15 15:19:14]
  • 评测
  • [2023-02-15 15:19:13]
  • 提交

answer

#include <lastweapon/io>
#include <lastweapon/fenwicktree>
using namespace lastweapon;

const int N = int(6e3) + 9;

int a[N], f[2][N], w[N][N]; VI A; int p = 0, q = 1;
int Q[N], P[N]; int cz, op;
int n, m;

int calc(int l, int r) {
    return f[q][l] + w[l+1][r];
}

int left(int a, int b) {
    int l = a, r = n+1;
    while (l < r) {
        int m = (l + r) / 2;
        if (calc(b, m) <= calc(a, m)) {
            r = m;
        } else {
            l = m + 1;
        }
    }
    return l;
}

int main() {
#ifndef ONLINE_JUDGE
     freopen("in.txt", "r", stdin);
#endif

    Rush {

        RD(n, m); A.clear(); REP(i, n) A.PB(RD(a[i])); UNQ(A);
        REP(i, n) a[i] = LBD(A, a[i]);

        REP(i, n) {
            fenwick_tree<int> T(SZ(A));
            FOR(j, i+1, n) {
                T.add(a[j-1], 1);
                w[i][j] = w[i][j-1] + (j-i) - T.sum(a[j]+1);
            }
        }

        REP(i, n) f[p][i] = w[0][i];

        REP_1(s, m) {
            swap(p, q); // FLC(f[p], 0x3f);
            cz = 0, op = 0; Q[0] = s-1;

            FOR(i, s, n) {
                //FOR(j, s-1, i) checkMin(f[p][i], calc(j, i));

                while (cz < op && P[cz] <= i) ++cz;
                int j = Q[cz]; f[p][i] = calc(j, i);
                //cout << j << " ";
                j = left(Q[op], i);
                while (cz < op && j <= P[op-1]) j = left(Q[--op], i);
                //cout << i << " "  << j << endl;
                P[op] = j; Q[++op] = i;

            }
            /*cout << endl;
            REP(i, op+1) cout << Q[i].fi << "," << Q[i].se<< " ";
            cout << endl;*/
        }

        cout << f[p][n-1] << endl;
    }

}

详细

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