QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#606141#8780. Training, Round 2rikka_lyly#WA 23ms6348kbC++201.8kb2024-10-02 22:25:062024-10-02 22:25:07

Judging History

This is the latest submission verdict.

  • [2024-10-02 22:25:07]
  • Judged
  • Verdict: WA
  • Time: 23ms
  • Memory: 6348kb
  • [2024-10-02 22:25:06]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ull unsigned long long
#define MAXN 5010

void solve()
{
    int n, xx, yy;
    cin >> n >> xx >> yy;
    vector<pair<pair<int, int>, pair<int, int>>> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i].first.first >> a[i].first.second >> a[i].second.first >> a[i].second.second;
        a[i].first.first = max(0, a[i].first.first - xx);
        a[i].first.second = max(-1, a[i].first.first - xx);
        a[i].second.first = max(0, a[i].second.first - yy);
        a[i].second.second = max(-1, a[i].second.first - yy);
    }
    vector<bitset<MAXN>> dp(n + 3);
    dp[0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        if(a[i].first.second == -1 || a[i].second.second == -1 || a[i].first.first >= n + 2 || a[i].second.first >= n + 2)
            continue;
        auto ndp = dp;
        for (int j = a[i].second.second; j >= a[i].second.first; j--)
        {
            bitset<MAXN> bt = dp[j];
            bt >>= a[i].first.first;
            bt <<= a[i].first.first;
            bt <<= MAXN - 1 - a[i].first.second;
            bt >>= MAXN - 1 - a[i].first.second;
            ndp[j + 1] |= bt;
            bt <<= 1;
            ndp[j] |= bt;
        }
        dp = ndp;
        // for (int j = 0; j <= n; j++)
        // {
        //     cerr << dp[j] << endl;
        // }
    }
    int ans = 0;
    for (int i = 0; i <= n; i++)
    {
        for (int j = 0; j <= n; j++)
        {
            if(dp[i][j])
                ans = max(ans, i + j);
        }
    }
    cout << ans << '\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t = 1;
    while (t--)
    {
        solve();
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3560kb

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
Wrong Answer
time: 23ms
memory: 6348kb

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:

0

result:

wrong answer 1st lines differ - expected: '5000', found: '0'