QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#100319#5378. 匹配问题zhouhuanyi0 144ms13232kbC++23813b2023-04-25 16:17:272023-04-25 16:17:29

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-25 16:17:29]
  • 评测
  • 测评结果:0
  • 用时:144ms
  • 内存:13232kb
  • [2023-04-25 16:17:27]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<algorithm>
#define N 500000
#define inf 1e9
using namespace std;
int read()
{
    char c=0;
    int sum=0;
    while (c<'0'||c>'9') c=getchar();
    while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
    return sum;
}
int n,ans,la,lb,a[N+1],b[N+1],l[N+1],r1[N+1],r2[N+1];
int main()
{
    int res=-inf;
    n=read(),la=read(),lb=read();
    for (int i=1;i<=n;++i) a[i]=read();
    for (int i=1;i<=n;++i) b[i]=read();
    sort(a+1,a+n+1),sort(b+1,b+n+1);
    for (int i=1;i<=n;++i) l[i]=lower_bound(b+1,b+n+1,a[i])-b-1,r1[i]=lower_bound(b+1,b+n+1,a[i]+la+1)-b-1,r2[i]=lower_bound(b+1,b+n+1,a[i]+lb+1)-b-1;
    for (int i=1;i<=n;++i)
    {
	if (r2[i]-i>=res) ans++; 
	res=max(res,l[i]-i+1);
    }
    printf("%d\n",ans);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 4
Accepted
time: 2ms
memory: 5500kb

input:

2 2 1
1 1
1 1

output:

2

result:

ok single line: '2'

Test #2:

score: -4
Wrong Answer
time: 3ms
memory: 7544kb

input:

10 200000 100000
34181 300096 24293 22680 402306 193269 438170 254676 188147 73971
216849 477743 461911 135785 467234 278230 287107 223666 124173 135091

output:

6

result:

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

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #100:

score: 0
Wrong Answer
time: 144ms
memory: 13232kb

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:

20

result:

wrong answer 1st lines differ - expected: '312193', found: '20'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%