QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#670628#8780. Training, Round 2myloveATRIWA 81ms12188kbC++201.8kb2024-10-23 22:37:312024-10-23 22:37:49

Judging History

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

  • [2024-10-23 22:37:49]
  • 评测
  • 测评结果:WA
  • 用时:81ms
  • 内存:12188kb
  • [2024-10-23 22:37:31]
  • 提交

answer

#include<bits/stdc++.h>
#include<queue>
#include<string.h>
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#define int long long
#define ll long long
#define ull unsigned long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define nl t[n].l
#define nr t[n].r
#define gcd __gcd
#define itn int
using namespace std;
const int maxn=1e6+50;
const int N=1e5+50;
const int inf=31525197391593473;
const int INF=2e18;
const int mod=998244353;
const double eps=1e-12;
#define pop_count __builtin_popcountll
//const ull mask = std::chrono::steady_clock::now().time_since_epoch().count();
int a[maxn],b[maxn],c[maxn],d[maxn];
set<int> s1[5005],s2[5005];
void solve()
{
   int n,k1,k2;
   cin>>n>>k1>>k2;
   rep(i,1,n)
   {
       cin>>a[i]>>b[i]>>c[i]>>d[i];
   }

   int ans=0;
   map<array<int,2>,int> mp;
   s1[0].insert(0);
   mp[{0,0}]=1;
   rep(i,1,n)
   {
       for(int o=n;o>=0;o--)
       {for(auto x:s1[o])
       {
           int j=o,k=x;
          // cout<<j<<' '<<k<<'\n';
           if(k1+j>=a[i]&&k1+j<=b[i]&&k2+k>=c[i]&&k2+k<=d[i])
            {
                  ans=max(ans,j+k+1);
                  if(!mp[{j,k+1}])
                    {
                        mp[{j,k+1}]++;
                        s2[o].insert(k+1);
                    }
                    if(!mp[{j+1,k}])
                    {
                        mp[{j+1,k}]++;
                        s2[o+1].insert({j+1,k});
                    }
            }
            else s2[o].insert({j,k});
       }
       swap(s1[o],s2[o]);
       s2[o].clear();
       }
   }
   cout<<ans;


}


signed main()
{
   ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
   int __=1;
   srand((time(0)));

  //cin>>__;

  while(__--)
  {
       solve();
  }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 10260kb

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: 81ms
memory: 12188kb

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:

8

result:

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