QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#446907 | #8780. Training, Round 2 | ucup-team3702 | WA | 1ms | 3560kb | C++23 | 1.1kb | 2024-06-17 17:48:30 | 2024-06-17 17:48:31 |
Judging History
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, ar - a); i++)
for (int j = std::max(0, bl - b); j <= std::min(p, 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";
// if (ans != 4997) std::cout << ans << "\n";
// else {
// 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";
// }
for (int j = 0; j <= 4997; j++)
if (not f[0][j]) std::cout << j << " ";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3560kb
input:
3 0 0 0 1 0 1 1 1 0 1 1 1 1 1
output:
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 ...
result:
wrong answer 1st lines differ - expected: '3', found: '3 4 5 6 7 8 9 10 11 12 13 14 1... 4992 4993 4994 4995 4996 4997 '