QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#129486 | #6326. Make Convex Sequence | KaphI | WA | 1ms | 3660kb | C++14 | 638b | 2023-07-22 20:03:23 | 2023-07-22 20:03:27 |
Judging History
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