QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#283844#6754. SelectionbobbilykingWA 10ms3544kbC++171.5kb2023-12-15 16:32:262023-12-15 16:32:26

Judging History

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

  • [2023-12-15 16:32:26]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:3544kb
  • [2023-12-15 16:32:26]
  • 提交

answer

#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pl;
typedef vector<ll> vl;
#define FD(i, r, l) for(ll i = r; i > (l); --i)

#define K first
#define V second
#define G(x) ll x; cin >> x;
#define GD(x) ld x; cin >> x;
#define GS(s) string s; cin >> s;
#define EX(x) { cout << x << '\n'; exit(0); }
#define A(a) (a).begin(), (a).end()
#define F(i, l, r) for (ll i = l; i < (r); ++i)

#define NN
#define M 1000000007 // 998244353


int main(){
//    freopen("a.in", "r", stdin);
//    freopen("a.out", "w", stdout);

    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(20);
    G(n) G(m) G(q)
    vl a(n+1), b(n+1);
    F(i, 1, n+1) cin >> a[i] >> b[i];
    while (q--) {
        G(t) G(x)
        if (t==1) b[x]^=1;
        else {
            vector<pl> g;
            ll gr = 0;
            F(i, 1, n+1) {
                if (b[i]) {
                    if (!gr || a[i] > a[gr]) gr = i; 
                }
                g.emplace_back(a[i], i);
            }
            sort(A(g));
            ll tm = m;
            bool works = x == gr;
            if (gr) g.erase(find(A(g), pair(a[gr], gr))), --tm;
            while (tm--) {
                works |= g.back().V == x; g.pop_back();
            }
            cout << works << '\n';
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 10ms
memory: 3544kb

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
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:

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