QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#491044 | #8780. Training, Round 2 | dalao_see_me | RE | 0ms | 0kb | C++14 | 1.2kb | 2024-07-25 17:05:59 | 2024-07-25 17:06:02 |
answer
#include <bits/stdc++.h>
using namespace std;
int read() {
int x = 0, f = 1; char c = getchar();
while (c < '0' || c > '9') {if (c == '-') f = -f; c = getchar();}
while (c >= '0' && c <= '9') {x = x * 10 + (c ^ 48); c = getchar();}
return x * f;
}
const int N = 5005;
int n, A, B, ans;
set <int> S[N];
int vis[N][N];
void ins(int x, int y) {
ans = max(ans, x + y - A - B);
if (vis[x - A][y - B]) return;
vis[x - A][y - B] = 1;
if (!vis[x - A + 1][y - B] || !vis[x - A][y - B + 1]) S[x - A].insert(y);
}
void Solve() {
n = read(); A = read(); B = read(); vis[0][0] = 1; S[0].insert(B);
for (int i = 1; i <= n; i++) {
int al = read(), ar = read(), bl = read(), br = read();
al = max(al, A);
for (int x = min(i - 1, ar - A); x >= al - A; x++) {
vector <int> tmp;
for (auto it = S[x].lower_bound(bl); it != S[x].end() && (*it) <= br; it++) tmp.push_back(*it);
for (int p : tmp) S[x].erase(p), ins(x + A + 1, p), ins(x + A, p + 1);
}
}
printf("%d\n", ans);
}
int main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
int _ = 1;
while (_--) Solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
3 0 0 0 1 0 1 1 1 0 1 1 1 1 1