QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#392040#6754. SelectionKir1sameWA 2ms3668kbC++171.5kb2024-04-17 02:53:082024-04-17 02:53:08

Judging History

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

  • [2024-04-17 02:53:08]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3668kb
  • [2024-04-17 02:53:08]
  • 提交

answer

#include<bits/stdc++.h>
//#pragma GCC optimize(3,"Ofast","inline")
using namespace std;
typedef long long ll;
typedef double db;
typedef unsigned long long  ull;
typedef pair<int,int> pii;
typedef pair<db,db> pdd;
typedef pair<ll,ll> pll;
void init();
void debug();
#define Clear(a)  memset(a,0,sizeof(a))
#define pb(x) push_back(x)
 
#define INF 1e9+10
const int N = 1e3+10;
const int M = 13210;
const int maxn = 3e5 +10;
const ll mod = 1e9+7;

const bool IN_TEST = 1;

vector<pii> a;
vector<int> gen;

    int n,m,q;
int query(int x)
{
    int gid=-1;
    for (int i=0;i<a.size();i++)
    {
        if (gen[a[i].second] == 1){
            gid = a[i].second;
            break;
        }
    }
    if (gid == x) return 1;

    bool hasg = 0;
    for (int i=0; i<m-1; i++)
    {
        auto [s, id] = a[i];
        if (gen[id] == 1) hasg = 1;
        if (id == x) return 1;
    }
    if (!hasg && a[m-1].second == x) return 1;
    return 0;
}

int main()
{
    cin>>n>>m>>q;
    a.resize(n);
    gen.resize(n);
    for (int i=0;i<n;i++)
    {
        cin>>a[i].first>>gen[i];
        a[i].second = i;
    }
    sort(a.begin(), a.end(), greater<pii>());

    while (q--)
    {
        int type;
        cin>>type;
        if (type == 1){
            int aa,b;
            cin>>aa>>b;
            gen[aa-1] = b;
        }
        else{
            int aa;
            cin>>aa;
            cout<<query(aa-1)<<endl;
        }
    }
    return 0;
}

詳細信息

Test #1:

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

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: 0
Accepted
time: 1ms
memory: 3668kb

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:

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

result:

ok 470 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

1000 1 1000
541 1
236 1
583 1
99 0
324 0
107 0
459 0
854 0
772 0
426 1
717 1
806 0
335 0
503 0
860 0
463 1
306 1
813 0
947 1
989 0
736 1
713 0
65 1
222 0
428 0
680 0
652 1
681 1
661 0
595 1
474 1
70 1
641 1
688 0
591 0
20 1
330 1
563 0
38 1
638 1
391 1
979 1
488 0
829 0
956 1
395 1
694 0
669 0
567 0...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 516 numbers

Test #4:

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

input:

1000 50 1000
950 0
163 0
276 0
422 1
449 0
81 0
245 1
995 1
908 1
466 0
123 0
848 1
749 0
370 1
86 1
299 1
384 0
570 1
678 0
713 0
360 0
737 0
627 0
60 1
250 1
88 1
915 1
145 0
863 0
925 1
742 0
409 1
858 1
441 0
803 0
811 1
575 0
47 0
271 1
107 1
431 0
677 1
704 0
340 0
160 0
856 1
176 0
488 1
832 ...

output:

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

result:

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