QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#272236#6754. Selectionmobbb#WA 2ms5736kbC++172.0kb2023-12-02 16:35:462023-12-02 16:35:46

Judging History

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

  • [2023-12-02 16:35:46]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5736kb
  • [2023-12-02 16:35:46]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define ll long long
const int N=2e5+100;

ll n,m,q;
ll num1[N];
ll num2[N];
ll sex[N];
set<ll> boy,girl;

    int main(void)
    {
        cin>>n>>m>>q;
        for(int i=1;i<=n;i++)
        {
            ll x,idx;   cin>>x>>idx;
            if(idx==1)
                girl.insert(x);
            else
                boy.insert(x);
            num1[x]=i;
            num2[i]=x;
            sex[i]=idx;
        }

        for(int i=1;i<=q;i++)
        {
            ll op;  cin>>op;
            if(op==1)
            {
                ll x,b; cin>>x>>b;
                if(sex[x]!=b)
                {
                    if(b==1)
                        boy.erase(num2[x]);
                    else
                        girl.erase(num2[x]);
                    sex[x]=b;
                }
            }
            else
            {
                ll x;   cin>>x;
                if(sex[x]==1)
                {
                    ll win=0;
                    for(auto T_T:girl)
                    {
                        win=T_T;
                        break;
                    }
                    if(win==num2[x])
                        cout<<"1\n";
                }
                else
                {
                    ll win_idx=m;
                    if(girl.size())
                        win_idx--;
                    bool flag=false;
                    for(auto T_T:boy)
                    {
                        if(T_T==num2[x])
                        {
                            flag=true;
                            break;
                        }
                        win_idx--;
                        if(win_idx==0)
                            break;
                    }
                    if(flag)
                        cout<<"1\n";
                    else
                        cout<<"0\n";
                }
            }
        }
        return 0;
    }

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 2 3
3 0
1 1
2 0
2 2
1 2 0
2 2

output:

1
0

result:

ok 2 number(s): "1 0"

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 5736kb

input:

1000 1 1000
617 0
199 0
776 0
536 1
258 0
311 1
579 0
844 0
356 1
587 0
564 0
782 0
37 1
717 1
612 1
245 1
444 1
750 0
52 1
92 1
741 0
266 1
71 1
189 1
419 1
580 1
585 1
268 1
255 0
490 1
70 1
497 1
829 1
469 1
641 0
929 1
379 1
507 0
474 1
407 0
221 1
985 0
815 1
217 0
445 1
386 0
132 0
154 0
736 1...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
...

result:

wrong answer 1st numbers differ - expected: '0', found: '1'