QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#446966#8780. Training, Round 2ucup-team3702TL 1ms3672kbC++23790b2024-06-17 19:22:382024-06-17 19:22:38

Judging History

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

  • [2024-06-17 19:22:38]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3672kb
  • [2024-06-17 19:22:38]
  • 提交

answer

#include <bits/stdc++.h>

const int N = 5e3 + 5;

int n, a, b, f[N][N], g[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, ar - a); i++)
            for (int j = std::max(0, bl - b); j <= std::min(p, br - b); j++)
                g[i + 1][j] |= f[i][j], g[i][j + 1] |= f[i][j];
        for (int i = 0; i <= p; i++)
            for (int j = 0; j <= p; j++)
                f[i][j] |= g[i][j], g[i][j] = 0;
    }
    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";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3672kb

input:

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

output:

3

result:

ok single line: '3'

Test #2:

score: -100
Time Limit Exceeded

input:

5000 801577551 932138594
801577551 801577551 932138594 932138594
801577552 801577552 932138594 932138594
801577552 801577552 932138595 932138595
801577552 801577552 932138596 932138596
801577553 801577553 932138596 932138596
801577553 801577553 932138597 932138597
801577553 801577553 932138598 93213...

output:


result: