QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#456787 | #8780. Training, Round 2 | ucup-team3678 | RE | 4ms | 5120kb | C++14 | 1.1kb | 2024-06-28 13:33:09 | 2024-06-28 13:33:10 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
set<int> S[N], z[N];
signed main() {
int n, p, q; scanf("%d%d%d", &n, &p, &q);
S[0].insert(0), z[0].insert(0);
for (int i = 1; i <= n; ++i) {
int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
a -= p, b -= p, c -= q, d -= q;
for (int j = min(i - 1, b); ~j && j >= a; --j) {
set<int>::iterator it = z[j].lower_bound(c);
vector<int> rm;
vector< pair<int, int> > ad;
while (it != z[j].end() && *it <= d) {
rm.push_back(*it);
if (!S[j].count((*it) + 1)) ad.push_back({j, (*it) + 1});
if (!S[j + 1].count(*it)) ad.push_back({j + 1, *it});
++it;
}
for (auto x : rm) z[j].erase(x);
for (auto [x, y] : ad) S[x].insert(y), z[x].insert(y);
}
}
int res = 0;
for (int i = 0; i <= n; ++i) {
if (!S[i].empty()) res = max(res, i + *--S[i].end());
}
printf("%d\n", res);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4516kb
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: 3ms
memory: 5004kb
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: 3ms
memory: 5120kb
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: 4ms
memory: 5000kb
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: 0
Accepted
time: 3ms
memory: 4920kb
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:
4994
result:
ok single line: '4994'
Test #6:
score: 0
Accepted
time: 2ms
memory: 4512kb
input:
5000 774827789 700294316 774827790 774827791 700294315 700294317 774827789 774827790 700294317 700294318 774827789 774827790 700294316 700294316 774827787 774827787 700294315 700294316 774827789 774827791 700294315 700294318 774827787 774827789 700294317 700294318 774827787 774827788 700294314 70029...
output:
5
result:
ok single line: '5'
Test #7:
score: 0
Accepted
time: 2ms
memory: 4144kb
input:
5000 700294316 774827789 700294315 700294317 774827790 774827791 700294317 700294318 774827789 774827790 700294316 700294316 774827789 774827790 700294315 700294316 774827787 774827787 700294315 700294318 774827789 774827791 700294317 700294318 774827787 774827789 700294314 700294318 774827787 77482...
output:
5
result:
ok single line: '5'
Test #8:
score: -100
Runtime Error
input:
5000 256309650 340081224 256309647 256309649 340081224 340081227 256309645 256309650 340081226 340081229 256309652 256309652 340081219 340081220 256309645 256309655 340081222 340081226 256309646 256309648 340081221 340081225 256309651 256309654 340081219 340081221 256309651 256309653 340081219 34008...