QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#356022 | #8338. Quad Kingdoms Chess | fxxx# | WA | 27ms | 3684kb | C++17 | 906b | 2024-03-17 14:49:22 | 2024-03-17 14:49:23 |
Judging History
answer
#include<bits/stdc++.h>
#define MAXN 100010
#define For(i,a,b) for (int i=(a);i<=(b);i++)
#define Rof(i,a,b) for (int i=(a);i>=(b);i--)
using namespace std;
int a[2][MAXN];
map<int,int> mp[2];
int main(){
std::ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n,m;cin>>n;
For(i,1,n){
cin>>a[0][i];
mp[0][a[0][i]]++;
}
cin>>m;
For(i,1,m){
cin>>a[1][i];
mp[1][a[1][i]]++;
}
int q;cin>>q;
while (q--){
int o,x,y;cin>>o>>x>>y;
o--;
mp[o][a[o][x]]--;
if (mp[o][a[o][x]]==0) mp[o].erase(a[o][x]);
a[o][x]=y;
mp[o][a[o][x]]++;
auto it=*(--mp[0].end()),jt=*(--mp[1].end());
if (it==jt) cout<<"YES\n";
else cout<<"NO\n";
}
}
/*
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
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3684kb
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: 27ms
memory: 3584kb
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'