QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#355220#8338. Quad Kingdoms Chessucup-team1525#WA 43ms3772kbC++17981b2024-03-16 14:37:462024-03-16 14:37:47

Judging History

This is the latest submission verdict.

  • [2024-03-16 14:37:47]
  • Judged
  • Verdict: WA
  • Time: 43ms
  • Memory: 3772kb
  • [2024-03-16 14:37:46]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
const int N=100005;
int a[N],b[N],n1,n2,m;
map<int,int> mp;
multiset<int>s;
int main()
{
    scanf("%d",&n1);
    for (int i=1;i<=n1;++i)
    {
        scanf("%d",&a[i]);
        s.insert(a[i]);
        mp[a[i]]+=1;
    }
    scanf("%d",&n2);
    for (int i=1;i<=n2;++i)
    {
        scanf("%d",&b[i]);
        s.insert(b[i]);
        mp[b[i]]-=1;
    }
    scanf("%d",&m);
    int opt,x,y;
    while (m--)
    {
        scanf("%d%d%d",&opt,&x,&y);
        if (opt==1)
        {
            mp[a[x]]-=1;
            auto it=s.find(a[x]);
            s.erase(it);
            a[x]=y;
            s.insert(a[x]);
            mp[a[x]]+=1;
        }
        else
        {
            mp[b[x]]+=1;
            auto it=s.find(b[x]);
            s.erase(it);
            b[x]=y;
            s.insert(b[x]);
            mp[b[x]]-=1;
        }
        puts(mp[*s.rbegin()]==0?"YES":"NO");
    }
}

詳細信息

Test #1:

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

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: 43ms
memory: 3672kb

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'