QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#129477#6326. Make Convex SequenceKaphIWA 28ms6260kbC++14559b2023-07-22 19:58:532023-07-22 19:59:00

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-22 19:59:00]
  • 评测
  • 测评结果:WA
  • 用时:28ms
  • 内存:6260kb
  • [2023-07-22 19:58:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=3e5+5;
int n,l[N],r[N],st[N],top;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d",&l[i]);
	for(int i=1;i<=n;++i)scanf("%d",&r[i]);
	st[++top]=1;
	for(int i=2;i<=n;++i){
		while(top>1&&r[st[top-1]]-r[st[top]]<r[st[top]]-r[i])top--;
		st[++top]=i;
	}
	for(int i=1,nw=1;i<=n;++i){
		if(nw<top&&st[nw+1]<i)++nw;
		int z=st[nw],y=st[nw+1];
		double w=(0.0+y-i)/(y-z)*r[z]+(0.0+i-z)/(y-z)*r[y];
		if(w<l[i]){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 5800kb

input:

4
2 1 2 5
4 6 5 8

output:

Yes

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 1ms
memory: 5696kb

input:

3
1 4 2
3 7 4

output:

No

result:

ok answer is NO

Test #3:

score: -100
Wrong Answer
time: 28ms
memory: 6260kb

input:

271757
150678576 28436211 82026915 150751377 329329758 207446456 449759844 245730845 425844298 93416110 220240900 414108016 268705922 158510126 362264528 715921 468258085 104286815 63874786 73971103 476243636 89261247 440888454 422989962 422041006 436065809 498263669 368104872 458751340 280953952 40...

output:

Yes

result:

wrong answer expected NO, found YES