QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}
Details
Tip: Click on the bar to expand more detailed information
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