QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#129477 | #6326. Make Convex Sequence | KaphI | WA | 28ms | 6260kb | C++14 | 559b | 2023-07-22 19:58:53 | 2023-07-22 19:59:00 |
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&&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