QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#606152#8780. Training, Round 2rikka_lyly#WA 34ms3692kbC++201.9kb2024-10-02 22:33:112024-10-02 22:33:14

Judging History

This is the latest submission verdict.

  • [2024-10-02 22:33:14]
  • Judged
  • Verdict: WA
  • Time: 34ms
  • Memory: 3692kb
  • [2024-10-02 22:33:11]
  • Submitted

answer

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

#define ll long long
#define ull unsigned long long
#define MAXN 5

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.second - xx);
        a[i].second.first = max(0, a[i].second.first - yy);
        a[i].second.second = max(-1, a[i].second.second - yy);
        a[i].first.second = min(n + 1, a[i].first.second);
        a[i].second.second = min(n + 1, a[i].first.second);
    }
    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();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3596kb

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: 34ms
memory: 3692kb

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:

4995

result:

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