110172024-06-04 19:57:01zsomborKutyák és macskákcpp17Partially correct 91.37/1001.289s760 KiB
#include "KutyakMacskak.h"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int c, d;

bool r(int a, int b) {
    return ask(d, a, b) == a;
}

vector <int> merge_sort(vector <int> v) {
    if (v.size() == 1) return v;
    vector <int> a;
    vector <int> b;
    for (int i = 0; i < v.size() / 2; i++) a.push_back(v[i]);
    for (int i = v.size() / 2; i < v.size(); i++) b.push_back(v[i]);
    v.clear();
    a = merge_sort(a);
    b = merge_sort(b);
    int i = 0, j = 0;
    while (i < a.size() && j < b.size()) {
        if (r(a[i], b[j])) { v.push_back(a[i]); i++; }
        else { v.push_back(b[j]); j++; }
    }
    while (i < a.size()) { v.push_back(a[i]); i++; }
    while (j < b.size()) { v.push_back(b[j]); j++; }
    return v;
}

vector <int> find_order(int n, int m) {
    c = 1;
    for (int i = 2; i <= m; i++) if (ask(1, c, i) == c) c = i;
    d = 1;
    for (int i = 1; i <= m; i++) {
        if (i == c || ask(d, c, i) == c) continue;
        d++;
        i--;
    }
    vector <int> ans;
    for (int i = 1; i <= m; i++) ans.push_back(i);
    ans = merge_sort(ans);
    return ans;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms412 KiB
2Accepted1.078s512 KiB
subtask26/6
3Accepted1.105s484 KiB
4Accepted1.105s380 KiB
5Accepted1.113s420 KiB
6Accepted1.115s544 KiB
7Accepted1.077s356 KiB
subtask37/7
8Accepted3ms504 KiB
9Accepted3ms356 KiB
10Accepted3ms384 KiB
11Accepted3ms416 KiB
12Accepted4ms384 KiB
13Accepted37ms636 KiB
14Accepted46ms392 KiB
subtask410/10
15Accepted10ms356 KiB
16Accepted9ms356 KiB
17Accepted13ms280 KiB
18Accepted12ms352 KiB
19Accepted10ms504 KiB
20Accepted9ms360 KiB
21Accepted13ms396 KiB
22Accepted12ms408 KiB
23Accepted12ms228 KiB
24Accepted12ms528 KiB
25Accepted10ms356 KiB
26Accepted13ms360 KiB
27Accepted13ms420 KiB
28Accepted10ms384 KiB
29Accepted13ms376 KiB
subtask512/12
30Accepted10ms356 KiB
31Accepted9ms356 KiB
32Accepted13ms280 KiB
33Accepted12ms352 KiB
34Accepted10ms504 KiB
35Accepted9ms360 KiB
36Accepted13ms396 KiB
37Accepted12ms408 KiB
38Accepted12ms228 KiB
39Accepted12ms528 KiB
40Accepted10ms356 KiB
41Accepted13ms360 KiB
42Accepted13ms420 KiB
43Accepted10ms384 KiB
44Accepted13ms376 KiB
45Accepted57ms420 KiB
46Accepted59ms416 KiB
47Accepted54ms376 KiB
48Accepted63ms412 KiB
49Accepted64ms356 KiB
50Accepted59ms504 KiB
51Accepted61ms420 KiB
52Accepted57ms420 KiB
53Accepted61ms488 KiB
54Accepted57ms356 KiB
55Accepted59ms356 KiB
56Accepted64ms388 KiB
57Accepted52ms488 KiB
58Accepted59ms356 KiB
59Accepted54ms484 KiB
subtask656.37/65
60Accepted3ms492 KiB
61Accepted1.105s396 KiB
62Accepted1.105s484 KiB
63Accepted1.105s380 KiB
64Accepted1.113s420 KiB
65Accepted1.115s544 KiB
66Accepted1.077s356 KiB
67Accepted3ms504 KiB
68Accepted3ms356 KiB
69Accepted3ms384 KiB
70Accepted3ms416 KiB
71Accepted4ms384 KiB
72Accepted37ms636 KiB
73Accepted46ms392 KiB
74Accepted10ms356 KiB
75Accepted9ms356 KiB
76Accepted13ms280 KiB
77Accepted12ms352 KiB
78Accepted10ms504 KiB
79Accepted9ms360 KiB
80Accepted13ms396 KiB
81Accepted12ms408 KiB
82Accepted12ms228 KiB
83Accepted12ms528 KiB
84Accepted10ms356 KiB
85Accepted13ms360 KiB
86Accepted13ms420 KiB
87Accepted10ms384 KiB
88Accepted13ms376 KiB
89Accepted57ms420 KiB
90Accepted59ms416 KiB
91Accepted54ms376 KiB
92Accepted63ms412 KiB
93Accepted64ms356 KiB
94Accepted59ms504 KiB
95Accepted61ms420 KiB
96Accepted57ms420 KiB
97Accepted61ms488 KiB
98Accepted57ms356 KiB
99Accepted59ms356 KiB
100Accepted64ms388 KiB
101Accepted52ms488 KiB
102Accepted59ms356 KiB
103Accepted54ms484 KiB
104Partially correct1.113s484 KiB
105Partially correct1.105s420 KiB
106Partially correct1.136s532 KiB
107Partially correct1.207s424 KiB
108Partially correct1.09s484 KiB
109Partially correct1.19s420 KiB
110Partially correct1.289s424 KiB
111Accepted1.113s484 KiB
112Accepted1.126s484 KiB
113Accepted1.113s632 KiB
114Partially correct1.126s356 KiB
115Partially correct1.128s508 KiB
116Partially correct1.139s356 KiB
117Partially correct1.133s676 KiB
118Partially correct1.136s420 KiB
119Partially correct1.134s424 KiB
120Partially correct1.152s520 KiB
121Partially correct1.136s428 KiB
122Partially correct1.167s424 KiB
123Partially correct1.156s500 KiB
124Partially correct1.231s356 KiB
125Partially correct1.269s612 KiB
126Partially correct1.2s760 KiB
127Partially correct1.156s504 KiB
128Partially correct1.156s532 KiB
129Partially correct1.123s424 KiB
130Partially correct1.131s480 KiB
131Partially correct1.131s668 KiB
132Partially correct1.149s500 KiB