QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#105843 | #6326. Make Convex Sequence | Sommohito# | RE | 2ms | 3384kb | C++20 | 1.4kb | 2023-05-15 17:44:13 | 2023-05-15 17:44:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#ifdef APURBA
#include "DEBUG_TEMPLATE.h"
#else
#define HERE
#define debug(args...)
#endif
#define ALL(x) x.begin(),x.end()
const int N = 2e5 +5;
typedef pair<int,int> pii;
typedef long double ld;
int n;
ll L[N],R[N];
void TEST_CASES()
{
cin>>n;
for(int i=0;i<n;i++) cin>>L[i];
for(int i=0;i<n;i++) cin>>R[i];
ld x=0,y=R[0];
ld low=-1e50,high=1e50;
int i=1;
ld last_x,last_y;
while(i<n)
{
ld temp_low=(L[i]-y)*1.0/(i-x);
ld temp_high=(R[i]-y)*1.0/(i-x);
if(temp_high<low)
{
cout<<"NO\n";
return;
}
if(high<temp_low||temp_high<low)
{
x=last_x;
y=last_y;
low=high;
high=1e50;
continue;
}
low=max(low,temp_low);
high=min(high,temp_high);
last_x=i;
last_y=y+(i-x)*high;
i++;
}
cout<<"YES\n";
}
/*
*/
int32_t main()
{
#ifndef APURBA
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
#endif
//freopen("input.txt","r",stdin);
//freopen("out1.txt","w",stdout);
int t=1;
//cin>>t;
while(t--)
{
TEST_CASES();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3384kb
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: 3208kb
input:
3 1 4 2 3 7 4
output:
NO
result:
ok answer is NO
Test #3:
score: -100
Runtime Error
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...