10992 | 2024-05-03 08:15:58 | TomaSajt | Kutyák és macskák | cpp17 | Partially correct 69.22/100 | 1.771s | 668 KiB |
#include "KutyakMacskak.h"
#include <bits/stdc++.h>
using namespace std;
bool is_closer(int k, int x, int y) {
if(x==y) return 0;
return ask(k,x,y)==x;
}
std::vector<int> find_order(int N, int M) {
int top_cat = 1;
for(int cat = 2; cat<=M; cat++) {
if(is_closer(1,top_cat,cat)) {
top_cat = cat;
}
}
int top_dog = -1;
for(int dog = 1; dog <= N; dog++) {
bool bad = 0;
for(int cat = 1; cat <= M; cat++) {
if(is_closer(dog,cat,top_cat)) {
bad = 1;
break;
}
}
if(!bad) {
top_dog = dog;
break;
}
}
vector<int> cat_poses(M);
iota(cat_poses.begin(),cat_poses.end(),1);
sort(cat_poses.begin(),cat_poses.end(), [&](int x, int y){ return is_closer(top_dog, x, y); });
return cat_poses;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 540 KiB | ||||
2 | Accepted | 1.646s | 436 KiB | ||||
subtask2 | 6/6 | ||||||
3 | Accepted | 1.383s | 488 KiB | ||||
4 | Accepted | 1.411s | 632 KiB | ||||
5 | Accepted | 1.592s | 540 KiB | ||||
6 | Accepted | 1.447s | 356 KiB | ||||
7 | Accepted | 1.574s | 500 KiB | ||||
subtask3 | 7/7 | ||||||
8 | Accepted | 3ms | 356 KiB | ||||
9 | Accepted | 4ms | 384 KiB | ||||
10 | Accepted | 3ms | 420 KiB | ||||
11 | Accepted | 4ms | 540 KiB | ||||
12 | Accepted | 3ms | 596 KiB | ||||
13 | Accepted | 37ms | 256 KiB | ||||
14 | Accepted | 48ms | 356 KiB | ||||
subtask4 | 10/10 | ||||||
15 | Accepted | 14ms | 356 KiB | ||||
16 | Accepted | 16ms | 504 KiB | ||||
17 | Accepted | 17ms | 356 KiB | ||||
18 | Accepted | 16ms | 256 KiB | ||||
19 | Accepted | 16ms | 356 KiB | ||||
20 | Accepted | 14ms | 484 KiB | ||||
21 | Accepted | 12ms | 356 KiB | ||||
22 | Accepted | 17ms | 272 KiB | ||||
23 | Accepted | 14ms | 504 KiB | ||||
24 | Accepted | 12ms | 360 KiB | ||||
25 | Accepted | 12ms | 376 KiB | ||||
26 | Accepted | 17ms | 356 KiB | ||||
27 | Accepted | 19ms | 384 KiB | ||||
28 | Accepted | 16ms | 384 KiB | ||||
29 | Accepted | 13ms | 428 KiB | ||||
subtask5 | 12/12 | ||||||
30 | Accepted | 14ms | 228 KiB | ||||
31 | Accepted | 16ms | 376 KiB | ||||
32 | Accepted | 17ms | 384 KiB | ||||
33 | Accepted | 17ms | 484 KiB | ||||
34 | Accepted | 16ms | 384 KiB | ||||
35 | Accepted | 14ms | 488 KiB | ||||
36 | Accepted | 14ms | 512 KiB | ||||
37 | Accepted | 17ms | 488 KiB | ||||
38 | Accepted | 14ms | 564 KiB | ||||
39 | Accepted | 17ms | 356 KiB | ||||
40 | Accepted | 17ms | 356 KiB | ||||
41 | Accepted | 14ms | 396 KiB | ||||
42 | Accepted | 19ms | 416 KiB | ||||
43 | Accepted | 16ms | 504 KiB | ||||
44 | Accepted | 17ms | 356 KiB | ||||
45 | Accepted | 75ms | 384 KiB | ||||
46 | Accepted | 79ms | 376 KiB | ||||
47 | Accepted | 75ms | 384 KiB | ||||
48 | Accepted | 68ms | 356 KiB | ||||
49 | Accepted | 75ms | 384 KiB | ||||
50 | Accepted | 78ms | 504 KiB | ||||
51 | Accepted | 79ms | 360 KiB | ||||
52 | Accepted | 79ms | 384 KiB | ||||
53 | Accepted | 71ms | 356 KiB | ||||
54 | Accepted | 76ms | 528 KiB | ||||
55 | Accepted | 82ms | 356 KiB | ||||
56 | Accepted | 79ms | 668 KiB | ||||
57 | Accepted | 82ms | 504 KiB | ||||
58 | Accepted | 78ms | 384 KiB | ||||
59 | Accepted | 79ms | 512 KiB | ||||
subtask6 | 34.22/65 | ||||||
60 | Accepted | 3ms | 524 KiB | ||||
61 | Accepted | 1.483s | 436 KiB | ||||
62 | Accepted | 1.411s | 420 KiB | ||||
63 | Accepted | 1.414s | 540 KiB | ||||
64 | Accepted | 1.419s | 440 KiB | ||||
65 | Accepted | 1.34s | 384 KiB | ||||
66 | Accepted | 1.36s | 368 KiB | ||||
67 | Accepted | 4ms | 360 KiB | ||||
68 | Accepted | 4ms | 412 KiB | ||||
69 | Accepted | 4ms | 504 KiB | ||||
70 | Accepted | 4ms | 384 KiB | ||||
71 | Accepted | 4ms | 492 KiB | ||||
72 | Accepted | 28ms | 532 KiB | ||||
73 | Accepted | 56ms | 356 KiB | ||||
74 | Accepted | 17ms | 504 KiB | ||||
75 | Accepted | 17ms | 256 KiB | ||||
76 | Accepted | 17ms | 508 KiB | ||||
77 | Accepted | 17ms | 504 KiB | ||||
78 | Accepted | 17ms | 484 KiB | ||||
79 | Accepted | 14ms | 384 KiB | ||||
80 | Accepted | 16ms | 484 KiB | ||||
81 | Accepted | 17ms | 612 KiB | ||||
82 | Accepted | 17ms | 504 KiB | ||||
83 | Accepted | 17ms | 356 KiB | ||||
84 | Accepted | 16ms | 488 KiB | ||||
85 | Accepted | 16ms | 504 KiB | ||||
86 | Accepted | 18ms | 356 KiB | ||||
87 | Accepted | 20ms | 356 KiB | ||||
88 | Accepted | 17ms | 356 KiB | ||||
89 | Accepted | 82ms | 356 KiB | ||||
90 | Accepted | 86ms | 356 KiB | ||||
91 | Accepted | 79ms | 360 KiB | ||||
92 | Accepted | 78ms | 384 KiB | ||||
93 | Accepted | 86ms | 504 KiB | ||||
94 | Accepted | 81ms | 356 KiB | ||||
95 | Accepted | 82ms | 356 KiB | ||||
96 | Accepted | 83ms | 504 KiB | ||||
97 | Accepted | 81ms | 384 KiB | ||||
98 | Accepted | 82ms | 500 KiB | ||||
99 | Accepted | 82ms | 356 KiB | ||||
100 | Accepted | 82ms | 356 KiB | ||||
101 | Accepted | 79ms | 504 KiB | ||||
102 | Accepted | 82ms | 484 KiB | ||||
103 | Accepted | 87ms | 504 KiB | ||||
104 | Partially correct | 1.634s | 484 KiB | ||||
105 | Partially correct | 1.733s | 484 KiB | ||||
106 | Partially correct | 1.493s | 484 KiB | ||||
107 | Partially correct | 1.666s | 356 KiB | ||||
108 | Partially correct | 1.495s | 484 KiB | ||||
109 | Partially correct | 1.498s | 484 KiB | ||||
110 | Partially correct | 1.516s | 624 KiB | ||||
111 | Accepted | 1.567s | 484 KiB | ||||
112 | Accepted | 1.508s | 632 KiB | ||||
113 | Accepted | 1.549s | 420 KiB | ||||
114 | Partially correct | 1.455s | 420 KiB | ||||
115 | Partially correct | 1.501s | 632 KiB | ||||
116 | Partially correct | 1.43s | 420 KiB | ||||
117 | Partially correct | 1.634s | 628 KiB | ||||
118 | Partially correct | 1.472s | 536 KiB | ||||
119 | Partially correct | 1.396s | 492 KiB | ||||
120 | Partially correct | 1.442s | 356 KiB | ||||
121 | Partially correct | 1.677s | 484 KiB | ||||
122 | Partially correct | 1.534s | 484 KiB | ||||
123 | Partially correct | 1.771s | 632 KiB | ||||
124 | Partially correct | 1.694s | 512 KiB | ||||
125 | Partially correct | 1.539s | 484 KiB | ||||
126 | Partially correct | 1.455s | 484 KiB | ||||
127 | Partially correct | 1.478s | 656 KiB | ||||
128 | Partially correct | 1.475s | 612 KiB | ||||
129 | Partially correct | 1.481s | 484 KiB | ||||
130 | Partially correct | 1.434s | 484 KiB | ||||
131 | Partially correct | 1.623s | 356 KiB | ||||
132 | Partially correct | 1.465s | 424 KiB |