QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#409523#8338. Quad Kingdoms ChessbigJWA 33ms3688kbC++231.4kb2024-05-12 10:44:572024-05-12 10:44:58

Judging History

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

  • [2024-05-12 10:44:58]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:3688kb
  • [2024-05-12 10:44:57]
  • 提交

answer

#include <bits/stdc++.h>

constexpr int N = 100000;

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 s1 = std::multiset(a.begin(), a.end());
    auto s2 = std::multiset(b.begin(), b.end());

    auto work = [&]() {
        if (a.back() != b.back()) {
            return false;
        }
        if (a.back() == *s1.rbegin() && b.back() == *s2.rbegin()) {
            return true;
        }
        return a == b;
    };

    scanf("%d", &m);
    for (int i = 0; i < m; i++) {
        int o, x, y;
        scanf("%d%d%d", &o, &x, &y);
        x--;
        if (o == 1) {
            s1.extract(a[x]);
            a[x] = y;
            s1.insert(a[x]);
        } else {
            s2.extract(a[x]);
            b[x] = y;
            s2.insert(a[x]);
        }
        if (work()) {
            puts("YES");
        } else {
            puts("NO");
        }
        // for (int j = 0; j < n1; j++) {
        //     printf("%d%c", a[j], " \n"[j == n1 - 1]);
        // }
        // for (int j = 0; j < n2; j++) {
        //     printf("%d%c", b[j], " \n"[j == n2 - 1]);
        // }
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3680kb

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: 33ms
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:

YES
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
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
N...

result:

wrong answer 1st words differ - expected: 'NO', found: 'YES'