109902024-05-02 16:46:56mraronKutyák és macskákcpp17Partially correct 92.15/1001.274s692 KiB
#include "KutyakMacskak.h"
#include<algorithm>
std::vector<int> find_order(int N, int M) {
    int fm=1;
    for(int i=2;i<=M;++i) {
        if(ask(1,fm,i)==fm) fm=i;
    }
    std::vector<int> ms;
    for(int i=1;i<=M;++i) if(i!=fm) ms.push_back(i);
    int ind=0, kind=1;
    while(ind<ms.size()) {
        if(ask(kind,ms[ind],fm)==fm) {
            ind++;
        }else {
            kind++;
        }
    }
    std::vector<int> res={ms[0]};
    for(int i=1;i<ms.size();++i) {
        auto it=upper_bound(res.begin(), res.end(), ms[i], [&](int x, int y) -> bool {
            return ask(kind, x, y)==x;
        });
        res.insert(it, ms[i]);
    }
    res.insert(res.begin(), fm);
    return res;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms400 KiB
2Accepted1.197s524 KiB
subtask26/6
3Accepted1.07s408 KiB
4Accepted1.11s504 KiB
5Accepted1.103s528 KiB
6Accepted1.12s424 KiB
7Accepted1.151s436 KiB
subtask37/7
8Accepted3ms396 KiB
9Accepted3ms504 KiB
10Accepted3ms616 KiB
11Accepted4ms384 KiB
12Accepted3ms368 KiB
13Accepted35ms500 KiB
14Accepted39ms356 KiB
subtask410/10
15Accepted10ms384 KiB
16Accepted8ms300 KiB
17Accepted10ms256 KiB
18Accepted9ms500 KiB
19Accepted12ms488 KiB
20Accepted12ms408 KiB
21Accepted9ms420 KiB
22Accepted12ms384 KiB
23Accepted9ms356 KiB
24Accepted9ms384 KiB
25Accepted9ms384 KiB
26Accepted8ms256 KiB
27Accepted10ms452 KiB
28Accepted13ms616 KiB
29Accepted13ms384 KiB
subtask512/12
30Accepted10ms384 KiB
31Accepted8ms300 KiB
32Accepted10ms256 KiB
33Accepted9ms500 KiB
34Accepted12ms488 KiB
35Accepted12ms408 KiB
36Accepted9ms420 KiB
37Accepted12ms384 KiB
38Accepted9ms356 KiB
39Accepted9ms384 KiB
40Accepted9ms384 KiB
41Accepted8ms256 KiB
42Accepted10ms452 KiB
43Accepted13ms616 KiB
44Accepted13ms384 KiB
45Accepted57ms356 KiB
46Accepted52ms376 KiB
47Accepted52ms360 KiB
48Accepted57ms408 KiB
49Accepted64ms484 KiB
50Accepted52ms420 KiB
51Accepted63ms408 KiB
52Accepted52ms356 KiB
53Accepted54ms424 KiB
54Accepted64ms632 KiB
55Accepted59ms424 KiB
56Accepted56ms484 KiB
57Accepted56ms356 KiB
58Accepted56ms384 KiB
59Accepted63ms384 KiB
subtask657.15/65
60Accepted3ms384 KiB
61Accepted1.09s564 KiB
62Accepted1.07s408 KiB
63Accepted1.11s504 KiB
64Accepted1.103s528 KiB
65Accepted1.12s424 KiB
66Accepted1.151s436 KiB
67Accepted3ms396 KiB
68Accepted3ms504 KiB
69Accepted3ms616 KiB
70Accepted4ms384 KiB
71Accepted3ms368 KiB
72Accepted35ms500 KiB
73Accepted39ms356 KiB
74Accepted10ms384 KiB
75Accepted8ms300 KiB
76Accepted10ms256 KiB
77Accepted9ms500 KiB
78Accepted12ms488 KiB
79Accepted12ms408 KiB
80Accepted9ms420 KiB
81Accepted12ms384 KiB
82Accepted9ms356 KiB
83Accepted9ms384 KiB
84Accepted9ms384 KiB
85Accepted8ms256 KiB
86Accepted10ms452 KiB
87Accepted13ms616 KiB
88Accepted13ms384 KiB
89Accepted57ms356 KiB
90Accepted52ms376 KiB
91Accepted52ms360 KiB
92Accepted57ms408 KiB
93Accepted64ms484 KiB
94Accepted52ms420 KiB
95Accepted63ms408 KiB
96Accepted52ms356 KiB
97Accepted54ms424 KiB
98Accepted64ms632 KiB
99Accepted59ms424 KiB
100Accepted56ms484 KiB
101Accepted56ms356 KiB
102Accepted56ms384 KiB
103Accepted63ms384 KiB
104Partially correct1.136s692 KiB
105Partially correct1.123s544 KiB
106Accepted1.133s492 KiB
107Partially correct1.12s452 KiB
108Partially correct1.274s428 KiB
109Partially correct1.261s548 KiB
110Partially correct1.118s552 KiB
111Accepted1.133s548 KiB
112Accepted1.111s612 KiB
113Accepted1.11s612 KiB
114Partially correct1.116s424 KiB
115Partially correct1.131s612 KiB
116Partially correct1.167s620 KiB
117Partially correct1.161s484 KiB
118Partially correct1.128s556 KiB
119Partially correct1.146s612 KiB
120Partially correct1.149s612 KiB
121Partially correct1.11s484 KiB
122Partially correct1.139s612 KiB
123Partially correct1.139s444 KiB
124Partially correct1.129s536 KiB
125Partially correct1.136s428 KiB
126Partially correct1.138s492 KiB
127Partially correct1.156s492 KiB
128Partially correct1.187s504 KiB
129Partially correct1.162s580 KiB
130Partially correct1.136s676 KiB
131Partially correct1.082s516 KiB
132Partially correct1.021s536 KiB