QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#491044#8780. Training, Round 2dalao_see_meRE 0ms0kbC++141.2kb2024-07-25 17:05:592024-07-25 17:06:02

Judging History

你现在查看的是最新测评结果

  • [2024-07-25 17:06:02]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-07-25 17:05:59]
  • 提交

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;
}

详细

Test #1:

score: 0
Runtime Error

input:

3 0 0
0 1 0 1
1 1 0 1
1 1 1 1

output:


result: