QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#409582#8338. Quad Kingdoms ChessbigJWA 40ms3688kbC++231.1kb2024-05-12 12:11:182024-05-12 12:11:19

Judging History

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

  • [2024-05-12 12:11:19]
  • 评测
  • 测评结果:WA
  • 用时:40ms
  • 内存:3688kb
  • [2024-05-12 12:11:18]
  • 提交

answer

#include <bits/stdc++.h>

int main() {
    int n1, n2, m;

    scanf("%d", &n1);
    std::vector<int> a(n1);
    for (int i = 0; i < n1; i++) {
        scanf("%d", &a[i]);
    }

    scanf("%d", &n2);
    std::vector<int> b(n2);
    for (int i = 0; i < n2; i++) {
        scanf("%d", &b[i]);
    }

    auto work = [&]() {
        std::vector<int> ans1, ans2;
        int mx = 0;
        for (int x : a | std::views::reverse) {
            mx = std::max(mx, x);
            // if (mx == x) {
            ans1.push_back(mx);
            // }
        }
        for (mx = 0; int x : b | std::views::reverse) {
            mx = std::max(mx, x);
            // if (mx == x) {
            ans2.push_back(mx);
            // }
        }
        return ans1 == ans2;
    };

    scanf("%d", &m);
    while (m--) {
        int o, x, y;
        scanf("%d%d%d", &o, &x, &y);
        x--;
        if (o == 1) {
            a[x] = y;
        } else {
            b[x] = y;
        }
        puts(work() ? "YES" : "NO");
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 2 3 4 5
5
5 4 3 2 1
8
1 1 5
1 4 2
1 2 4
1 5 1
1 5 5
2 1 4
2 3 5
2 5 5

output:

NO
NO
NO
YES
NO
NO
NO
YES

result:

ok 8 tokens

Test #2:

score: -100
Wrong Answer
time: 40ms
memory: 3688kb

input:

1
2
6
2 1 1 1 1 1
200000
2 6 2
1 1 1
1 1 1
1 1 2
2 1 1
1 1 2
1 1 1
2 4 1
2 1 2
1 1 1
1 1 2
2 5 1
1 1 1
1 1 2
1 1 1
2 6 1
1 1 2
1 1 2
1 1 2
2 3 1
1 1 1
2 1 1
2 6 2
1 1 2
2 4 1
1 1 2
2 6 1
1 1 2
1 1 1
2 5 2
2 6 2
1 1 1
2 4 2
2 5 2
2 6 2
1 1 1
2 5 1
2 6 2
1 1 2
1 1 1
1 1 1
2 4 1
1 1 2
1 1 2
1 1 2
2 3 2...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

wrong answer 5th words differ - expected: 'YES', found: 'NO'