QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#491035 | #8780. Training, Round 2 | dalao_see_me | WA | 2ms | 24184kb | C++14 | 1.2kb | 2024-07-25 17:04:52 | 2024-07-25 17:04:52 |
Judging History
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 = al - A; x <= min(i - 1, ar - 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;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3972kb
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: 0ms
memory: 14864kb
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: 0ms
memory: 13848kb
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: 2ms
memory: 4528kb
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: 0ms
memory: 24184kb
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'