11017 | 2024-06-04 19:57:01 | zsombor | Kutyák és macskák | cpp17 | Partially correct 91.37/100 | 1.289s | 760 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;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 412 KiB | ||||
2 | Accepted | 1.078s | 512 KiB | ||||
subtask2 | 6/6 | ||||||
3 | Accepted | 1.105s | 484 KiB | ||||
4 | Accepted | 1.105s | 380 KiB | ||||
5 | Accepted | 1.113s | 420 KiB | ||||
6 | Accepted | 1.115s | 544 KiB | ||||
7 | Accepted | 1.077s | 356 KiB | ||||
subtask3 | 7/7 | ||||||
8 | Accepted | 3ms | 504 KiB | ||||
9 | Accepted | 3ms | 356 KiB | ||||
10 | Accepted | 3ms | 384 KiB | ||||
11 | Accepted | 3ms | 416 KiB | ||||
12 | Accepted | 4ms | 384 KiB | ||||
13 | Accepted | 37ms | 636 KiB | ||||
14 | Accepted | 46ms | 392 KiB | ||||
subtask4 | 10/10 | ||||||
15 | Accepted | 10ms | 356 KiB | ||||
16 | Accepted | 9ms | 356 KiB | ||||
17 | Accepted | 13ms | 280 KiB | ||||
18 | Accepted | 12ms | 352 KiB | ||||
19 | Accepted | 10ms | 504 KiB | ||||
20 | Accepted | 9ms | 360 KiB | ||||
21 | Accepted | 13ms | 396 KiB | ||||
22 | Accepted | 12ms | 408 KiB | ||||
23 | Accepted | 12ms | 228 KiB | ||||
24 | Accepted | 12ms | 528 KiB | ||||
25 | Accepted | 10ms | 356 KiB | ||||
26 | Accepted | 13ms | 360 KiB | ||||
27 | Accepted | 13ms | 420 KiB | ||||
28 | Accepted | 10ms | 384 KiB | ||||
29 | Accepted | 13ms | 376 KiB | ||||
subtask5 | 12/12 | ||||||
30 | Accepted | 10ms | 356 KiB | ||||
31 | Accepted | 9ms | 356 KiB | ||||
32 | Accepted | 13ms | 280 KiB | ||||
33 | Accepted | 12ms | 352 KiB | ||||
34 | Accepted | 10ms | 504 KiB | ||||
35 | Accepted | 9ms | 360 KiB | ||||
36 | Accepted | 13ms | 396 KiB | ||||
37 | Accepted | 12ms | 408 KiB | ||||
38 | Accepted | 12ms | 228 KiB | ||||
39 | Accepted | 12ms | 528 KiB | ||||
40 | Accepted | 10ms | 356 KiB | ||||
41 | Accepted | 13ms | 360 KiB | ||||
42 | Accepted | 13ms | 420 KiB | ||||
43 | Accepted | 10ms | 384 KiB | ||||
44 | Accepted | 13ms | 376 KiB | ||||
45 | Accepted | 57ms | 420 KiB | ||||
46 | Accepted | 59ms | 416 KiB | ||||
47 | Accepted | 54ms | 376 KiB | ||||
48 | Accepted | 63ms | 412 KiB | ||||
49 | Accepted | 64ms | 356 KiB | ||||
50 | Accepted | 59ms | 504 KiB | ||||
51 | Accepted | 61ms | 420 KiB | ||||
52 | Accepted | 57ms | 420 KiB | ||||
53 | Accepted | 61ms | 488 KiB | ||||
54 | Accepted | 57ms | 356 KiB | ||||
55 | Accepted | 59ms | 356 KiB | ||||
56 | Accepted | 64ms | 388 KiB | ||||
57 | Accepted | 52ms | 488 KiB | ||||
58 | Accepted | 59ms | 356 KiB | ||||
59 | Accepted | 54ms | 484 KiB | ||||
subtask6 | 56.37/65 | ||||||
60 | Accepted | 3ms | 492 KiB | ||||
61 | Accepted | 1.105s | 396 KiB | ||||
62 | Accepted | 1.105s | 484 KiB | ||||
63 | Accepted | 1.105s | 380 KiB | ||||
64 | Accepted | 1.113s | 420 KiB | ||||
65 | Accepted | 1.115s | 544 KiB | ||||
66 | Accepted | 1.077s | 356 KiB | ||||
67 | Accepted | 3ms | 504 KiB | ||||
68 | Accepted | 3ms | 356 KiB | ||||
69 | Accepted | 3ms | 384 KiB | ||||
70 | Accepted | 3ms | 416 KiB | ||||
71 | Accepted | 4ms | 384 KiB | ||||
72 | Accepted | 37ms | 636 KiB | ||||
73 | Accepted | 46ms | 392 KiB | ||||
74 | Accepted | 10ms | 356 KiB | ||||
75 | Accepted | 9ms | 356 KiB | ||||
76 | Accepted | 13ms | 280 KiB | ||||
77 | Accepted | 12ms | 352 KiB | ||||
78 | Accepted | 10ms | 504 KiB | ||||
79 | Accepted | 9ms | 360 KiB | ||||
80 | Accepted | 13ms | 396 KiB | ||||
81 | Accepted | 12ms | 408 KiB | ||||
82 | Accepted | 12ms | 228 KiB | ||||
83 | Accepted | 12ms | 528 KiB | ||||
84 | Accepted | 10ms | 356 KiB | ||||
85 | Accepted | 13ms | 360 KiB | ||||
86 | Accepted | 13ms | 420 KiB | ||||
87 | Accepted | 10ms | 384 KiB | ||||
88 | Accepted | 13ms | 376 KiB | ||||
89 | Accepted | 57ms | 420 KiB | ||||
90 | Accepted | 59ms | 416 KiB | ||||
91 | Accepted | 54ms | 376 KiB | ||||
92 | Accepted | 63ms | 412 KiB | ||||
93 | Accepted | 64ms | 356 KiB | ||||
94 | Accepted | 59ms | 504 KiB | ||||
95 | Accepted | 61ms | 420 KiB | ||||
96 | Accepted | 57ms | 420 KiB | ||||
97 | Accepted | 61ms | 488 KiB | ||||
98 | Accepted | 57ms | 356 KiB | ||||
99 | Accepted | 59ms | 356 KiB | ||||
100 | Accepted | 64ms | 388 KiB | ||||
101 | Accepted | 52ms | 488 KiB | ||||
102 | Accepted | 59ms | 356 KiB | ||||
103 | Accepted | 54ms | 484 KiB | ||||
104 | Partially correct | 1.113s | 484 KiB | ||||
105 | Partially correct | 1.105s | 420 KiB | ||||
106 | Partially correct | 1.136s | 532 KiB | ||||
107 | Partially correct | 1.207s | 424 KiB | ||||
108 | Partially correct | 1.09s | 484 KiB | ||||
109 | Partially correct | 1.19s | 420 KiB | ||||
110 | Partially correct | 1.289s | 424 KiB | ||||
111 | Accepted | 1.113s | 484 KiB | ||||
112 | Accepted | 1.126s | 484 KiB | ||||
113 | Accepted | 1.113s | 632 KiB | ||||
114 | Partially correct | 1.126s | 356 KiB | ||||
115 | Partially correct | 1.128s | 508 KiB | ||||
116 | Partially correct | 1.139s | 356 KiB | ||||
117 | Partially correct | 1.133s | 676 KiB | ||||
118 | Partially correct | 1.136s | 420 KiB | ||||
119 | Partially correct | 1.134s | 424 KiB | ||||
120 | Partially correct | 1.152s | 520 KiB | ||||
121 | Partially correct | 1.136s | 428 KiB | ||||
122 | Partially correct | 1.167s | 424 KiB | ||||
123 | Partially correct | 1.156s | 500 KiB | ||||
124 | Partially correct | 1.231s | 356 KiB | ||||
125 | Partially correct | 1.269s | 612 KiB | ||||
126 | Partially correct | 1.2s | 760 KiB | ||||
127 | Partially correct | 1.156s | 504 KiB | ||||
128 | Partially correct | 1.156s | 532 KiB | ||||
129 | Partially correct | 1.123s | 424 KiB | ||||
130 | Partially correct | 1.131s | 480 KiB | ||||
131 | Partially correct | 1.131s | 668 KiB | ||||
132 | Partially correct | 1.149s | 500 KiB |