QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882212#2787. Teamsthangthang13 20ms9216kbC++201.2kb2025-02-04 22:09:292025-02-04 22:09:39

Judging History

This is the latest submission verdict.

  • [2025-02-04 22:09:39]
  • Judged
  • Verdict: 13
  • Time: 20ms
  • Memory: 9216kb
  • [2025-02-04 22:09:29]
  • Submitted

answer

#ifdef ONLINE_JUDGE

#include "teams.h"

#endif // ONLINE_JUDGE

#include <bits/stdc++.h>

using namespace std;

const int MaxN = 5e5 + 5;

int n, a[MaxN], b[MaxN];
int q, m, k[MaxN];
vector <int> ri[MaxN];

void init(int N, int A[], int B[]){
    n = N;
    for (int i = 0; i < n; ++ i)
        ri[A[i]].push_back(B[i]);
}

int query[MaxN];

int can(int M, int K[]){
    for (int i = 0; i < M; ++ i)
        query[K[i]] ++;

    priority_queue <int, vector <int>, greater <int>> pq;

    for (int l = 1; l <= n; ++ l){
        while (pq.size() && pq.top() < l) pq.pop();
        for (int r : ri[l]) pq.push(r);
        for (int loops = 0; loops < query[l] * l; loops ++){
            if (pq.empty()) return 0;
            pq.pop();
        }
        query[l] = 0;
    }

    return 1;
}

#ifndef ONLINE_JUDGE

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    cin >> n;
    for (int i = 0; i < n; ++ i)
        cin >> a[i] >> b[i];

    init(n, a, b);

    cin >> q;
    for (int loops = 0; loops < q; ++ loops){
        cin >> m;
        for (int i = 0; i < m; ++ i)
            cin >> k[i];

        cout << can(m, k) << "\n";
    }
}

#endif // ONLINE_JUDGE

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 21
Accepted
time: 0ms
memory: 3840kb

input:

4
2 4
1 2
2 3
2 3
2
2 1 3
2 1 1

output:

1
0

result:

ok 2 lines

Test #2:

score: 21
Accepted
time: 0ms
memory: 3712kb

input:

5
2 3
2 2
3 4
2 2
1 1
1
3 2 1 2

output:

0

result:

ok single line: '0'

Test #3:

score: 21
Accepted
time: 0ms
memory: 3840kb

input:

100
3 61
37 63
52 79
42 87
5 38
13 33
56 95
53 95
69 96
23 51
30 87
31 79
2 58
41 95
13 89
51 86
5 46
71 81
3 7
21 91
23 90
11 85
50 88
31 77
26 27
31 91
23 66
32 48
22 79
36 81
42 46
33 76
67 79
41 48
15 42
4 51
21 90
51 92
60 90
31 78
21 93
62 94
88 98
25 79
23 59
27 52
46 85
12 43
15 28
20 96
24 ...

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

result:

ok 100 lines

Test #4:

score: 21
Accepted
time: 0ms
memory: 3840kb

input:

100
47 100
59 68
22 81
26 31
23 59
13 98
24 28
37 63
15 72
60 74
7 89
62 94
1 60
30 87
71 81
6 29
13 89
52 79
36 53
69 77
2 58
3 61
34 48
21 91
39 47
43 85
21 90
31 50
36 81
13 28
33 76
5 77
24 85
28 59
29 57
53 95
12 43
51 92
7 20
15 28
3 7
17 47
78 90
49 94
67 76
60 82
46 85
41 48
32 48
20 46
20 9...

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

result:

ok 100 lines

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

100
31 79
43 85
5 38
78 90
31 78
92 97
13 98
36 81
17 47
23 59
56 95
25 79
9 66
24 61
88 98
33 76
4 51
50 88
22 79
14 66
7 20
94 98
15 72
24 85
29 57
7 89
41 95
5 6
36 53
51 86
6 29
21 93
31 50
60 90
53 95
26 31
3 7
46 60
58 62
32 48
51 77
24 28
46 85
23 66
21 91
11 85
85 93
31 77
67 79
13 28
2 58
5...

output:

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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 3rd lines differ - expected: '1', found: '0'

Subtask #2:

score: 13
Accepted

Test #27:

score: 13
Accepted
time: 9ms
memory: 8832kb

input:

100000
46503 61502
34278 63026
24651 60296
27921 32693
40654 78541
38357 97853
50234 74256
28875 64172
1156 66821
33682 85011
38633 55442
26468 75403
7744 95912
7639 20373
3489 65670
44385 68195
80744 92399
443 48207
20978 48590
42574 66994
94782 98699
69048 75985
3748 51039
56069 88210
15619 22502
...

output:

0

result:

ok single line: '0'

Test #28:

score: 13
Accepted
time: 8ms
memory: 8704kb

input:

100000
23870 62096
6565 45612
1109 94686
60692 94017
34512 95079
64450 77378
21832 56221
45089 57006
46643 50408
96079 97119
60110 82767
11385 91389
34321 46387
53829 66069
14404 75150
6213 57606
43918 82140
4948 55435
23376 51028
22205 30478
29042 31756
31998 33180
41368 57346
52764 68043
11566 707...

output:

0

result:

ok single line: '0'

Test #29:

score: 13
Accepted
time: 17ms
memory: 9068kb

input:

100000
59419 71286
61502 99530
19798 67560
47714 64697
63194 78267
31804 43941
85524 99088
15970 21868
15988 90245
63235 72884
63991 89776
41084 64662
16736 30436
38234 67822
6618 77375
24943 64281
54442 81083
68112 82304
24706 89837
23429 56940
67196 81327
7563 54090
44866 92572
42558 53589
7177 12...

output:

0

result:

ok single line: '0'

Test #30:

score: 13
Accepted
time: 9ms
memory: 9088kb

input:

100000
1944 80185
69187 72472
34047 96645
10337 26581
37740 38042
86446 89641
8612 40278
58479 86291
603 66823
24457 68474
32273 58099
66226 82969
48942 92984
10992 85845
12327 80011
51720 65232
9785 60095
42330 61984
64948 97483
2241 27315
17115 18722
70340 71532
15354 85275
7477 32850
52595 91322
...

output:

0

result:

ok single line: '0'

Test #31:

score: 13
Accepted
time: 4ms
memory: 5760kb

input:

100000
150 150
381 381
205 205
56 56
300 300
420 420
324 324
354 354
286 286
445 445
204 204
291 291
135 135
444 444
266 266
371 371
302 302
112 112
198 198
345 345
264 264
301 301
286 286
379 379
237 237
273 273
381 381
294 294
434 434
387 387
267 267
253 253
425 425
442 442
349 349
302 302
377 377...

output:

1

result:

ok single line: '1'

Test #32:

score: 13
Accepted
time: 4ms
memory: 5376kb

input:

100000
189 189
279 279
274 274
318 318
366 366
148 148
403 403
331 331
182 182
163 163
416 416
103 103
415 415
146 146
243 243
403 403
166 166
440 440
285 285
410 410
433 433
341 341
47 47
312 312
141 141
114 114
432 432
319 319
225 225
417 417
290 290
377 377
439 439
140 140
154 154
374 374
447 447...

output:

0

result:

ok single line: '0'

Test #33:

score: 13
Accepted
time: 2ms
memory: 5376kb

input:

100000
306 306
407 407
371 371
329 329
386 386
426 426
306 306
289 289
432 432
422 422
251 251
222 222
245 245
351 351
245 245
329 329
310 310
447 447
354 354
193 193
254 254
185 185
447 447
213 213
352 352
300 300
300 300
360 360
251 251
406 406
290 290
424 424
392 392
366 366
240 240
408 408
82 82...

output:

0

result:

ok single line: '0'

Test #34:

score: 13
Accepted
time: 3ms
memory: 5376kb

input:

100000
288 288
147 147
434 434
245 245
319 319
214 214
224 224
398 398
135 135
431 431
379 379
242 242
439 439
397 397
278 278
242 242
87 87
256 256
245 245
148 148
308 308
368 368
319 319
440 440
372 372
329 329
429 429
397 397
329 329
400 400
360 360
110 110
382 382
430 430
269 269
136 136
437 437...

output:

0

result:

ok single line: '0'

Test #35:

score: 13
Accepted
time: 4ms
memory: 5496kb

input:

99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 9999...

output:

1

result:

ok single line: '1'

Test #36:

score: 13
Accepted
time: 1ms
memory: 5368kb

input:

100000
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 10
1 1...

output:

1

result:

ok single line: '1'

Test #37:

score: 13
Accepted
time: 5ms
memory: 5384kb

input:

100000
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100
1 100...

output:

1

result:

ok single line: '1'

Test #38:

score: 13
Accepted
time: 1ms
memory: 5324kb

input:

100000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
455 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
713 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 1000
1 ...

output:

1

result:

ok single line: '1'

Test #39:

score: 13
Accepted
time: 8ms
memory: 5648kb

input:

100000
8162 10000
1 10000
712 10000
5986 10000
7869 10000
5708 10000
4853 10000
1 10000
2567 10000
6281 10000
1 10000
5924 10000
1 6604
1711 10000
1981 10000
1494 10000
4305 10000
5556 10000
4569 10000
4472 10000
5256 10000
6971 10000
5054 10000
2026 10000
1 10000
1 9793
1 10000
350 10000
1475 10000...

output:

0

result:

ok single line: '0'

Test #40:

score: 13
Accepted
time: 12ms
memory: 7932kb

input:

100000
1 100000
1 100000
1 61463
6557 100000
11729 100000
1 100000
1 96830
1 100000
47187 100000
20676 100000
1 79883
1 62760
1 100000
29542 100000
13253 93933
1 89136
39828 100000
2710 94095
48473 100000
1 100000
56836 100000
24474 100000
1 100000
1 27061
1 84956
1 100000
8870 100000
1 100000
1961 ...

output:

0

result:

ok single line: '0'

Test #41:

score: 13
Accepted
time: 20ms
memory: 8960kb

input:

100000
820 7380
46181 51134
72130 99478
72850 77374
182 819
2460 5740
54381 91152
455 728
17564 92470
2460 5740
53321 90354
54439 84476
49549 91563
76298 89255
55362 63577
41319 55992
10866 60669
21972 88220
57550 88475
1640 3280
13565 15582
2460 6560
76230 87982
27625 67032
47671 55920
53915 82225
...

output:

1

result:

ok single line: '1'

Test #42:

score: 13
Accepted
time: 7ms
memory: 8320kb

input:

100000
56887 90939
7380 7380
820 3280
30703 81245
58966 97620
76924 91839
3280 7380
50 90
17343 80087
60471 72319
30922 57565
7415 8431
65613 77470
32387 58759
14987 66910
94362 97004
35459 52904
47748 80607
90133 91902
40035 70242
1640 6560
88522 89119
33081 51735
26162 81455
89516 95086
820 4100
8...

output:

0

result:

ok single line: '0'

Test #43:

score: 13
Accepted
time: 8ms
memory: 7168kb

input:

100000
15624 15624
3905 3905
3906 11718
15624 15624
19530 19530
2343 3124
19530 19530
3906 11718
11718 11718
1562 2343
19545 26588
11718 15624
19530 19530
19530 19530
19530 19530
15624 15624
11718 15624
3906 3906
19530 19530
3906 3906
781 3124
19530 19530
19530 19530
156 156
19530 19530
11718 11718
...

output:

1

result:

ok single line: '1'

Test #44:

score: 13
Accepted
time: 6ms
memory: 7208kb

input:

100000
15624 15624
7812 11718
11718 15624
15624 15624
11718 19530
15624 15624
1562 3124
76364 78324
19530 19530
15624 15624
156 780
3906 19530
3906 11718
3905 3905
19530 19530
3906 19530
7812 11718
19530 19530
7812 11718
1562 1562
15624 15624
1562 1562
781 3124
3124 3124
15624 15624
2343 3905
23734 ...

output:

1

result:

ok single line: '1'

Test #45:

score: 13
Accepted
time: 11ms
memory: 9216kb

input:

100000
24450 64802
24665 24987
58306 83144
19950 46523
366 82576
54278 87745
32057 48157
65418 71339
51344 78343
13902 30167
23423 98346
16615 71863
37743 57951
13036 51654
4381 58761
35384 73127
19236 46593
21464 59802
52680 80454
10903 99356
37911 51619
85996 88098
33286 96175
3024 44212
27451 362...

output:

0

result:

ok single line: '0'

Test #46:

score: 13
Accepted
time: 3ms
memory: 5496kb

input:

99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 99998
1 9999...

output:

1

result:

ok single line: '1'

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%