QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#368981#6326. Make Convex SequenceVengeful_Spirit#WA 34ms6224kbC++20821b2024-03-27 18:47:512024-03-27 18:47:53

Judging History

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

  • [2024-03-27 18:47:53]
  • 评测
  • 测评结果:WA
  • 用时:34ms
  • 内存:6224kb
  • [2024-03-27 18:47:51]
  • 提交

answer

#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
void cmax(int &x, int y) {x  = std::max(x, y);}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    vector<int>l(n+1);
    vector<int>r(n+1);
    vector<int>a(n+1);
    for(int i=1;i<=n;i++){
        cin>>l[i];
    }
    for(int i=1;i<=n;i++){
        cin>>r[i];
    }
    a[1]=r[1];
    a[2]=l[2];
    for(int i=3;i<=n;i++){
        int lim=a[i-1]-(a[i-2]-a[i-1]);
      //  cout<<lim<<" ";
        if(lim>=l[i]&&lim<=r[i]){
            a[i]=lim;
        }
        else if(lim<l[i]){
            a[i]=l[i];
        }
        else{
            cout<<"No"<<endl;
            return 0;
        }
     //   cout<<a[i]<<"   ";
    }
    cout<<"Yes"<<endl;
    

    
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

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: 3536kb

input:

3
1 4 2
3 7 4

output:

No

result:

ok answer is NO

Test #3:

score: 0
Accepted
time: 34ms
memory: 6224kb

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: 20ms
memory: 5656kb

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