QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#446889#8780. Training, Round 2ucup-team3702WA 0ms3652kbC++23933b2024-06-17 17:24:092024-06-17 17:24:09

Judging History

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

  • [2024-06-17 17:24:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3652kb
  • [2024-06-17 17:24:09]
  • 提交

answer

#include <bits/stdc++.h>

const int N = 5e3 + 5;

int n, a, b, f[N][N];

int main () {
    std::cin >> n >> a >> b;
    f[0][0] = 1;
    for (int al, ar, bl, br, p = 1; p <= n; p++) {
        std::cin >> al >> ar >> bl >> br;
        for (int i = std::max(0, al - a); i <= std::min(p, std::max(0, ar - a)); i++)
            for (int j = std::max(0, bl - b); j <= std::min(p, std::max(0, br - b)); j++)
                f[i + 1][j] |= f[i][j], f[i][j + 1] |= f[i][j];
    }
    // int ans = 0;
    // for (int i = 0; i <= n; i++)
    //     for (int j = 0; j <= n; j++)
    //         ans = std::max(ans, f[i][j] * (i + j));
    // std::cout << ans << "\n";
    int max = 0, pi, pj;
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= n; j++)
            if (f[i][j] * (i + j) > max)
                max = f[i][j] * (i + j), pi = i, pj = j;
    std::cout << pi << " " << pj << "\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3652kb

input:

3 0 0
0 1 0 1
1 1 0 1
1 1 1 1

output:

1 2

result:

wrong answer 1st lines differ - expected: '3', found: '1 2'