QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410769#73. Mineralsasupersalmon0 0ms0kbC++141.8kb2024-05-14 14:36:012024-05-14 14:36:02

Judging History

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

  • [2024-05-14 14:36:02]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-05-14 14:36:01]
  • 提交

answer

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


void Solve(int N) {
    int v = Query(1);
    int v1;
    vector<int> ve = {1};
    vector<int> co = {};
    vector<pair<int,int>> ans = {};

    for(int i = 2; i <= 2 * N; i++){
        v1 = Query(i);
        ve.push_back(i);
        if(v1 == v){
            Query(i);
            ve.pop_back();
            co.push_back(i);
        }
    }

    vector<pair<pair<int,int>,vector<int>>> steck = {{{0, N - 1}, co}};

    while(!steck.empty()){
        pair<int,int> r = steck.back().first;
        vector<int> guys = steck.back().second;
        int s = r.first;
        int e = r.second;
        int m = (s + e)/2;

        if(guys.size() == r.second - r.first + 1){
            if(s == e){
                ans.push_back({s,guys[0]});
                while(steck.back().first.second == e){
                    steck.pop_back();
                }
                continue;
            }
            else{
                int sise;
                for(int i = m + 1; i <= e; i++){
                    sise = Query(ve[i]);
                }
                vector<int> v1,v2;
                for(int i : guys){
                    int temp = Query(i);
                    if(temp == sise){
                        v2.push_back(i);
                    }
                    else{
                        v1.push_back(i);
                    }
                    sise = temp;
                }

                guys = v2;
                steck.push_back({{s,m},v1});
            }
        }
        else{
            for(int i = m + 1; i <= e; i++){
                Query(ve[i]);
            }

            steck.push_back({{m + 1,e},guys});
        }
    }

    for(pair<int,int> ii : ans){
        Answer(ii.first,ii.second);
    }


}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 0
Time Limit Exceeded

input:

10
19 7
2 13
10 18
16 17
15 8
20 12
6 1
5 11
9 4
14 3

output:

Unauthorized output

result:


Subtask #2:

score: 0
Time Limit Exceeded

Test #5:

score: 0
Time Limit Exceeded

input:

1000
71 1441
504 1818
856 1348
505 1014
246 1249
301 1054
733 1631
477 1146
890 1128
927 1037
752 1944
261 1453
677 1264
334 1292
649 1136
850 1535
372 1669
690 1465
552 1008
632 1546
953 1505
118 1343
877 1045
689 1463
406 1199
27 1904
409 1419
435 1468
983 1706
790 1756
998 1134
417 1339
676 1644
...

output:

Unauthorized output

result:


Subtask #3:

score: 0
Time Limit Exceeded

Test #10:

score: 0
Time Limit Exceeded

input:

1000
1086 1459
1665 730
1828 1430
182 205
1390 430
692 506
1155 1564
1451 294
673 639
1100 149
1952 1866
1889 878
408 611
1139 154
300 1009
1395 1019
618 1845
1195 1596
1178 1384
569 1093
1147 1208
793 704
1677 977
641 1180
1357 1010
254 96
1581 948
1212 1254
283 312
1593 944
1960 1917
360 139
582 8...

output:

Unauthorized output

result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #15:

score: 0
Time Limit Exceeded

input:

38000
59215 52683
55301 10339
7136 74175
19615 367
627 25723
68621 47313
4022 50538
33743 20356
13177 26746
58664 38147
69175 75544
34036 43398
73372 7410
10431 12525
67205 11597
63717 11164
10715 51228
57281 71998
65259 18952
49981 28719
50966 73187
57158 73146
59836 7069
72392 75926
65552 9514
516...

output:

Unauthorized output

result:


Subtask #5:

score: 0
Time Limit Exceeded

Test #19:

score: 0
Time Limit Exceeded

input:

39000
22259 19524
49412 72777
70627 33049
52935 18381
36470 34692
59059 61108
21181 37595
7448 1760
9314 31607
43425 45921
25297 44306
71633 41677
31654 51785
50494 28977
8138 14556
48595 21085
13474 68624
60145 55410
15273 30732
56392 26930
55409 45198
18152 14548
28482 61155
21608 62483
13202 6092...

output:

Unauthorized output

result:


Subtask #6:

score: 0
Time Limit Exceeded

Test #23:

score: 0
Time Limit Exceeded

input:

40000
77595 17395
78532 3136
52560 17938
71960 78212
65773 73784
9210 40755
22431 33565
27704 5920
54686 12437
64706 77829
61984 31471
62411 49974
63743 41557
13662 21450
24433 63033
56164 37960
28803 14363
34466 72960
46737 368
17361 54062
4696 54496
77879 76259
75656 57095
66232 18361
68729 46965
...

output:

Unauthorized output

result:


Subtask #7:

score: 0
Time Limit Exceeded

Test #27:

score: 0
Time Limit Exceeded

input:

41000
20874 15182
80174 4001
24055 24381
19335 42391
5765 39861
28079 46949
9053 71698
69207 11791
31981 57851
19636 49421
68545 72057
81934 41458
64695 3755
52792 31861
7895 18162
9597 48924
81569 80678
62690 53908
50769 63724
278 18237
56843 38451
39110 54788
59760 27167
43698 75607
44238 20803
26...

output:

Unauthorized output

result:


Subtask #8:

score: 0
Time Limit Exceeded

Test #31:

score: 0
Time Limit Exceeded

input:

42000
40256 64311
22189 23808
12888 63256
37941 23894
63645 5344
5729 20427
18535 78027
25440 56073
45779 74076
77955 77961
10838 73121
3743 35880
15785 26949
16000 73643
28016 66721
73740 11332
38057 61890
70080 74190
5256 73895
39091 35407
71643 72100
39328 11151
44057 28416
26054 27895
51211 5268...

output:

Unauthorized output

result:


Subtask #9:

score: 0
Time Limit Exceeded

Test #35:

score: 0
Time Limit Exceeded

input:

43000
51972 74184
65517 14510
85263 49532
31788 1750
43544 8633
418 33357
26577 53596
32482 8713
67907 49133
47570 80150
71652 11337
40521 30582
46881 31714
25904 69177
60834 14368
7246 63195
80775 53724
17949 40374
3451 77149
27951 63639
41397 52162
24797 10441
30350 50445
44967 43314
50170 44303
1...

output:

Unauthorized output

result: