QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#378643#8338. Quad Kingdoms ChessBUET_POTATOES#WA 28ms3624kbC++23882b2024-04-06 13:56:342024-04-06 13:56:34

Judging History

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

  • [2024-04-06 13:56:34]
  • 评测
  • 测评结果:WA
  • 用时:28ms
  • 内存:3624kb
  • [2024-04-06 13:56:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;


void testcase(int cs){
    int n1, n2;
    cin >> n1;
    vector<int> v[2];
    map<int, int> mp[2];
    v[0].resize(n1);
    for(auto &x : v[0]){
        cin >> x;
        ++mp[0][x];
    }
    cin >> n2;
    v[1].resize(n2);
    for(auto &x : v[1]){
        cin >> x;
        ++mp[1][x];
    }

    int q;
    cin >> q;
    while(q--){
        int o, x, y;
        cin >> o >> x >> y;
        --o, --x;
        if(--mp[o][v[o][x]] == 0){
            mp[o].erase(v[o][x]);
        }
        v[o][x] = y;
        ++mp[o][y];
        if(*mp[0].rbegin() == *mp[1].rbegin())cout << "YES\n";
        else cout << "NO\n";
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int T = 1;
//    cin >> T;
    for(int cs = 1; cs <= T; ++cs){
        testcase(cs);
    }
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
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: 28ms
memory: 3576kb

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

result:

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