QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#670259#8780. Training, Round 2myloveATRIWA 48ms90712kbC++201.9kb2024-10-23 21:03:572024-10-23 21:03:59

Judging History

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

  • [2024-10-23 21:03:59]
  • 评测
  • 测评结果:WA
  • 用时:48ms
  • 内存:90712kb
  • [2024-10-23 21:03:57]
  • 提交

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];
int f[5005][5005];
int ma[5005];
void solve()
{
   int n,k1,k2;
   cin>>n>>k1>>k2;
   rep(i,1,n)
   {
       cin>>a[i]>>b[i]>>c[i]>>d[i];
   }
   f[0][0]=1;
   int lim=0;
   rep(i,1,n)
   {
       int ok=lim;
       for(int k=0;k<=n;k++)
       {
           int j=lim;
           if(f[j][k]&&k1+j>=a[i]&&k1+j<=b[i]&&k2+k>=c[i]&&k2+k<=d[i])
            {
                   f[j+1][k]=f[j][k+1]=1;
                   ma[j]=max(ma[j],k+1);
                   ma[j+1]=max(ma[j+1],k);
                   ok=max(ok,j+1);
            }
       }
       for(int j=lim-1;j>=0;j--)
       {
           int k=ma[j];
           {
               if(f[j][k]&&k1+j>=a[i]&&k1+j<=b[i]&&k2+k>=c[i]&&k2+k<=d[i])
               {
                   f[j+1][k]=f[j][k+1]=1;
                   ma[j]=max(ma[j],k+1);
                   ma[j+1]=max(ma[j+1],k);
               }
           }
       }
       lim=ok;
   }
   int ans=0;
   rep(i,0,n)
   {
       rep(j,0,n)
       {
           if(f[i][j]) ans=max(i+j,ans);
       }
   }
   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: 0ms
memory: 11768kb

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: 48ms
memory: 90712kb

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: 42ms
memory: 78668kb

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: 35ms
memory: 12040kb

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: 40ms
memory: 15984kb

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:

7

result:

wrong answer 1st lines differ - expected: '4994', found: '7'