QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#152234#6326. Make Convex Sequenceaesthetic#WA 42ms8088kbC++14707b2023-08-27 20:03:262023-08-27 20:03:27

Judging History

你现在查看的是最新测评结果

  • [2023-08-27 20:03:27]
  • 评测
  • 测评结果:WA
  • 用时:42ms
  • 内存:8088kb
  • [2023-08-27 20:03:26]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
const int MAXN = 300300;
int n;
long long l[MAXN], r[MAXN];

int main()
{
	#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout); 
    #endif
    ios_base::sync_with_stdio(false), cin.tie(NULL);
    cin >> n;
    for(int i = 1; i <= n; ++i)
    	cin >> l[i];
    for(int i = 1; i <= n; ++i)
    	cin >> r[i];

    long long cur = l[1], d = l[2] - l[1];
    for(int i = 2; i <= n; ++i)
    {
    	long long aux = max(cur + d, l[i]);
    	if(aux > r[i])
    	{
    		cout << "No" << endl;
    		return 0;
    	}
    	d = max(d, aux - cur);
    	cur = aux;
    }
    cout << "Yes" << endl;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 5644kb

input:

4
2 1 2 5
4 6 5 8

output:

Yes

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 0ms
memory: 5644kb

input:

3
1 4 2
3 7 4

output:

No

result:

ok answer is NO

Test #3:

score: 0
Accepted
time: 42ms
memory: 8088kb

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: 29ms
memory: 7680kb

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