QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#129486#6326. Make Convex SequenceKaphIWA 1ms3660kbC++14638b2023-07-22 20:03:232023-07-22 20:03:27

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 20:03:27]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3660kb
  • [2023-07-22 20:03:23]
  • 提交

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&&1ll*(i-st[top])*(r[st[top-1]]-r[st[top]])<1ll*(st[top]-st[top-1])*(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];
		printf("__%lf  %d %d\n",w,z,y);
		if(w<l[i]){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3660kb

input:

4
2 1 2 5
4 6 5 8

output:

__4.000000  1 3
__4.500000  1 3
__5.000000  1 3
__8.000000  3 4
Yes

result:

wrong output format YES or NO expected, but __4.000000 found