QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#445895#6773. True Storyship2077WA 12ms5124kbC++17783b2024-06-16 16:47:112024-06-16 16:47:11

Judging History

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

  • [2024-06-16 16:47:11]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:5124kb
  • [2024-06-16 16:47:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=1e5+5;
int n,m,x,s[M],p[M],t[M];
int read(){
	int x=0,f=1;char ch=getchar();
	while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
	return x*f;
}
bool check(int s){
	int need=(x-1)/s+1;
	for (int i=0,lst;need>0&&i<=m;lst=t[i++])
		if (need<=p[i]-lst)
			need-=t[i+1]-t[i]; 
	return need<=0;
}
int main(){
	n=read();m=read();x=read();p[0]=read();
	for (int i=1;i<=n;i++) s[i]=read();
	sort(s+1,s+n+1); t[m+1]=0x3f3f3f3f;
	for (int i=1;i<=m;i++) t[i]=read();
	for (int i=1;i<=m;i++) p[i]=read();
	int l=1,r=n,ans=0;
	while (l<=r){
		int mid=l+r>>1;
		if (check(s[mid])) ans=n-mid+1,r=mid-1;
		else l=mid+1;
	}
	printf("%d\n",ans);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3852kb

input:

4 3 10 4
1 5 2 1
3 4 5
7 9 10

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3892kb

input:

1 3 10 3
1
2 3 4
5 8 10

output:

0

result:

ok single line: '0'

Test #3:

score: 0
Accepted
time: 12ms
memory: 5124kb

input:

100000 100000 544857367 2
45337851 26009328 15109007 11351428 108994261 7849241 17594424 49523907 45417024 54467076 60475979 54550753 30367925 22635509 272520858 49488818 90740887 32100499 21719978 20217697 22756760 32141867 23665455 90791528 30224242 21821163 23727178 13022129 30321908 21859760 341...

output:

100000

result:

ok single line: '100000'

Test #4:

score: 0
Accepted
time: 6ms
memory: 4940kb

input:

100000 100000 952144339 3
55978491 28891209 30764133 73202535 10363511 26399650 73193857 11050595 50138706 35213415 158763870 45394118 29711543 27226014 18347560 47615161 52942830 45283718 45268901 79349900 12634867 21153206 19438268 38106844 52860935 25132415 68017329 33907567 23855866 21625728 433...

output:

100000

result:

ok single line: '100000'

Test #5:

score: -100
Wrong Answer
time: 12ms
memory: 5012kb

input:

100000 100000 861312012 213
2930319 4924031 22699434 5536443 8274332 18738805 6676085 8383208 57465745 4425773 18042887 7619913 3971674 6899778 4032324 14434558 45293265 6527910 11865850 8503737 6801962 9561267 19600731 39190716 10483549 6288014 7777162 14447687 4032050 2209849 10854895 6635250 1167...

output:

100000

result:

wrong answer 1st lines differ - expected: '99999', found: '100000'