QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#491369 | #8780. Training, Round 2 | aqz180321 | RE | 0ms | 3856kb | C++14 | 971b | 2024-07-25 19:05:04 | 2024-07-25 19:05:05 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <cstdio>
#include <set>
#include <vector>
const int N = 5e3 + 10;
int n, a, b, ans;
bool vis[N][N];
std::set < int > s[N];
std::vector < int > tmp;
void ins (int x, int y) {
ans = std::max(ans, x + y - a - b);
if (vis[x - a][y - b]) return ;
vis[x - a][y - b] = true;
if (!vis[x - a + 1][y - b] || !vis[x - a][y - b + 1]) s[x - a].insert(y);
}
int main() {
std::cin >> n >> a >> b;
vis[0][0] = 1;
s[a].insert(b);
for (int i = 1, la, ra, lb, rb; i <= n; i++) {
std::cin >> la >> ra >> lb >> rb;
la = std::max(la - a, 0);
ra = std::min(ra - a, i - 1);
for (int j = la; j <= ra; j++) {
tmp.clear();
std::set < int >::iterator it = s[j].lower_bound(lb);
for ( ; it != s[j].end() && (*it) <= rb; it++)
tmp.push_back(*it);
for (auto v : tmp) {
s[j].erase(v);
ins(j + a + 1, v);
ins(j + a, v + 1);
}
}
}
std::cout << ans;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3856kb
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
Runtime Error
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...