QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#491394 | #8780. Training, Round 2 | qL | WA | 13ms | 3984kb | C++14 | 721b | 2024-07-25 19:14:23 | 2024-07-25 19:14:23 |
Judging History
answer
#include <algorithm>
#include <cstdio>
using i32 = int;
constexpr i32 N = 5000;
i32 n, a0, b0;
i32 L[N + 1], R[N + 1];
signed main() noexcept {
scanf("%d%d%d", &n, &a0, &b0);
for (i32 i = 0; i <= n; ++i) R[i] = -n, L[i] = n;
L[0] = R[0] = b0;
for (i32 i = 1, al, ar, bl, br; i <= n; ++i) {
scanf("%d%d%d%d", &al, &ar, &bl, &br);
for (i32 j = i; ~j; --j)
if (al <= j + a0 && j + a0 <= ar) {
i32 l = std::max(L[j], bl), r = std::min(R[j], br);
if (l <= r)
R[j] = std::max(R[j], r + 1), L[j + 1] = std::min(L[j + 1], l), R[j + 1] = std::max(R[j + 1], r);
}
}
i32 ans = 0;
for (i32 i = 0; i <= n; ++i) ans = std::max(ans, i + R[i] - b0);
printf("%d\n", ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3880kb
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: 0
Accepted
time: 13ms
memory: 3900kb
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:
5000
result:
ok single line: '5000'
Test #3:
score: 0
Accepted
time: 12ms
memory: 3892kb
input:
5000 932138594 801577551 932138594 932138594 801577551 801577551 932138594 932138594 801577552 801577552 932138595 932138595 801577552 801577552 932138596 932138596 801577552 801577552 932138596 932138596 801577553 801577553 932138597 932138597 801577553 801577553 932138598 932138598 801577553 80157...
output:
5000
result:
ok single line: '5000'
Test #4:
score: 0
Accepted
time: 12ms
memory: 3984kb
input:
5000 76836128 716580777 76836128 76836128 716580777 716580777 76836129 76836129 716580777 716580777 76836130 76836130 716580777 716580777 76836131 76836131 716580777 716580777 76836131 76836131 716580778 716580778 76836131 76836131 716580779 716580779 76836131 76836131 716580780 716580780 76836128 7...
output:
4994
result:
ok single line: '4994'
Test #5:
score: -100
Wrong Answer
time: 13ms
memory: 3824kb
input:
5000 716580777 76836128 716580777 716580777 76836128 76836128 716580777 716580777 76836129 76836129 716580777 716580777 76836130 76836130 716580777 716580777 76836131 76836131 716580778 716580778 76836131 76836131 716580779 716580779 76836131 76836131 716580780 716580780 76836131 76836131 716580778 ...
output:
4997
result:
wrong answer 1st lines differ - expected: '4994', found: '4997'