QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#670666 | #8780. Training, Round 2 | myloveATRI | WA | 0ms | 12244kb | C++20 | 1.9kb | 2024-10-23 22:53:26 | 2024-10-23 22:53:26 |
Judging History
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);
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(mp[{j,k}]) continue;
if(k1+j>=a[i]&&k1+j<=b[i]&&k2+k>=c[i]&&k2+k<=d[i])
{
ans=max(ans,j+k+1);
mp[{j,k}]++;
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(k);
}
}
else s2[o].insert(k);
}
}
rep(j,0,n)
{
swap(s1[j],s2[j]);
s2[j].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: 0
Wrong Answer
time: 0ms
memory: 12244kb
input:
3 0 0 0 1 0 1 1 1 0 1 1 1 1 1
output:
1
result:
wrong answer 1st lines differ - expected: '3', found: '1'