QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#178801 | #5378. 匹配问题 | Lynkcat# | 0 | 2ms | 7688kb | C++20 | 979b | 2023-09-14 13:42:37 | 2024-07-04 01:57:20 |
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
#define N 1000005
using namespace std;
int n,la,lb;
int a[N],b[N],dp[N];
void BellaKira()
{
cin>>n>>la>>lb;
for (int i=1;i<=n;i++)
cin>>a[i];
for (int i=1;i<=n;i++)
cin>>b[i];
sort(a+1,a+n+1);
sort(b+1,b+n+1);
dp[0]=0;
for (int i=1;i<=n;i++)
{
bool bl=1;
for (int j=i;j<=n;j++)
{
if (bl&&b[j]<=a[i]+la)
dp[j]=max(dp[i-1]+j-i,dp[j]);
bl&=(b[j]>=a[i+1]&&b[j]<=a[i+1]+lb);
}
}
cout<<dp[n]<<'\n';
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
while (T--)
{
BellaKira();
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 7688kb
input:
2 2 1 1 1 1 1
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Time Limit Exceeded
Test #100:
score: 0
Time Limit Exceeded
input:
500000 500000 10 200184 74991 71203 334998 316800 34483 120570 301054 331108 232072 189788 397143 490296 56807 361700 88818 42376 460305 371750 450351 338384 429789 426045 445029 152316 408919 188124 144966 457495 475025 225370 260510 383159 495247 54319 246245 240728 372033 439599 119720 449020 451...
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
0%