QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#491370 | #8780. Training, Round 2 | aqz180321 | WA | 11ms | 24404kb | C++14 | 971b | 2024-07-25 19:06:04 | 2024-07-25 19:06: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[0].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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3928kb
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: 8ms
memory: 14392kb
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: 7ms
memory: 13620kb
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: 3ms
memory: 3976kb
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: 11ms
memory: 24404kb
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'