QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#553511#6326. Make Convex Sequenceucup-team3691#WA 34ms7524kbC++23986b2024-09-08 14:29:522024-09-08 14:29:52

Judging History

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

  • [2024-09-08 14:29:52]
  • 评测
  • 测评结果:WA
  • 用时:34ms
  • 内存:7524kb
  • [2024-09-08 14:29:52]
  • 提交

answer

#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <ctime>
#include <random>
#include <cassert>

using namespace std;
using ll = long long;

void solve() {
    int n;
    cin >> n;
    vector <pair <ll, ll>> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i].first;
    }
    for (int i = 0; i < n; i++) {
        cin >> v[i].second;
    }
    for (int i = 2; i < n; i++) {
        ll x = 2 * v[i - 1].first - v[i - 2].second;
        v[i].first = max(v[i].first, x);
        if (v[i].first > v[i].second) {
            cout << "No\n";
            return;
        }
    }
    cout << "Yes\n";
}

signed main() {
#ifdef LOCAL
    freopen("test.in", "r", stdin);
    freopen("test.out", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int nrt = 1;
    //cin >> nrt;
    while (nrt--) {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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

input:

3
1 4 2
3 7 4

output:

No

result:

ok answer is NO

Test #3:

score: -100
Wrong Answer
time: 34ms
memory: 7524kb

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