QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#100146 | #6326. Make Convex Sequence | changtu | WA | 65ms | 12716kb | C++23 | 891b | 2023-04-24 20:06:35 | 2023-04-24 20:06:36 |
Judging History
answer
#include<iostream>
#include<algorithm>
#include<string.h>
#include<vector>
using namespace std;
// #define debug(x) cout<<"[debug]"#x<<"="<<x<<endl
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const ld eps=1e-8;
const int INF=0x3f3f3f3f,mod=998244353;
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define debug(...)
#include<debug>
#else
#define debug(...)
#endif
const int N=300005;
ld l[N];
ld r[N];
int n;
ld p[N];
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%Lf",&l[i]);
for(int i=1;i<=n;i++) scanf("%Lf",&r[i]);
p[1]=r[1];
p[2]=l[2];
for(int i=3;i<=n;i++)
{
p[i]=max(l[i],p[i-1]+(p[i-1]-p[i-2]));
if(p[i]>r[i]+eps)
{
puts("No");
return 0;
}
p[i-1]=min(r[i-1],p[i-2]+(p[i]-p[i-2])/2);
}
puts("Yes");
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 7660kb
input:
4 2 1 2 5 4 6 5 8
output:
Yes
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 3ms
memory: 7668kb
input:
3 1 4 2 3 7 4
output:
No
result:
ok answer is NO
Test #3:
score: 0
Accepted
time: 65ms
memory: 12716kb
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:
No
result:
ok answer is NO
Test #4:
score: -100
Wrong Answer
time: 63ms
memory: 11748kb
input:
221577 208524335 361831745 22019877 116938872 278766714 208490439 171991803 306449871 80504409 482889061 476216429 301986974 27811645 339159639 66711961 161280073 484108185 49066593 138136569 482494706 410430125 227818963 2765261 373817725 460818032 441004900 291595145 154693942 282220531 451435733 ...
output:
No
result:
wrong answer expected YES, found NO