Submission #1186998

#TimeUsernameProblemLanguageResultExecution timeMemory
1186998woohyun_jngNaan (JOI19_naan)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define int long long
#define __int128_t ll

using namespace std;

typedef array<int, 2> fr;

const int MAX = 2001;

int V[MAX][MAX], S[MAX];
fr D[MAX][MAX];
bool chk[MAX];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int N, L, S, X, Y;
    fr K;

    vector<int> P;

    cin >> N >> L;
    for (int i = 1; i <= N; i++) {
        S = X = Y = 0;
        for (int j = 1; j <= L; j++)
            cin >> V[i][j], S += V[i][j];
        for (int j = 1; j <= N - 1; j++) {
            while (S * j >= N * (Y + V[i][X + 1]))
                Y += V[i][++X];
            D[i][j] = {S * j - N * Y + X * N * V[i][X + 1], N * V[i][X + 1]};
        }
        D[i][N] = {0, 0};
    }

    for (int i = 1; i <= N; i++) {
        K = {MAX, 1}, X = -1;
        for (int j = 1; j <= N; j++) {
            if (chk[j])
                continue;
            if (comp(D[j][i], K))
                K = D[j][i], X = j;
        }

        if (i < N)
            cout << K[0] << ' ' << K[1] << '\n';
        P.push_back(X), Y = K[1], chk[X] = true;
    }

    for (int i : P)
        cout << i << ' ';
    cout << '\n';

    return 0;
}

Compilation message (stderr)

naan.cpp: In function 'int main()':
naan.cpp:42:17: error: 'comp' was not declared in this scope
   42 |             if (comp(D[j][i], K))
      |                 ^~~~