109922024-05-03 08:15:58TomaSajtKutyák és macskákcpp17Partially correct 69.22/1001.771s668 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms540 KiB
2Accepted1.646s436 KiB
subtask26/6
3Accepted1.383s488 KiB
4Accepted1.411s632 KiB
5Accepted1.592s540 KiB
6Accepted1.447s356 KiB
7Accepted1.574s500 KiB
subtask37/7
8Accepted3ms356 KiB
9Accepted4ms384 KiB
10Accepted3ms420 KiB
11Accepted4ms540 KiB
12Accepted3ms596 KiB
13Accepted37ms256 KiB
14Accepted48ms356 KiB
subtask410/10
15Accepted14ms356 KiB
16Accepted16ms504 KiB
17Accepted17ms356 KiB
18Accepted16ms256 KiB
19Accepted16ms356 KiB
20Accepted14ms484 KiB
21Accepted12ms356 KiB
22Accepted17ms272 KiB
23Accepted14ms504 KiB
24Accepted12ms360 KiB
25Accepted12ms376 KiB
26Accepted17ms356 KiB
27Accepted19ms384 KiB
28Accepted16ms384 KiB
29Accepted13ms428 KiB
subtask512/12
30Accepted14ms228 KiB
31Accepted16ms376 KiB
32Accepted17ms384 KiB
33Accepted17ms484 KiB
34Accepted16ms384 KiB
35Accepted14ms488 KiB
36Accepted14ms512 KiB
37Accepted17ms488 KiB
38Accepted14ms564 KiB
39Accepted17ms356 KiB
40Accepted17ms356 KiB
41Accepted14ms396 KiB
42Accepted19ms416 KiB
43Accepted16ms504 KiB
44Accepted17ms356 KiB
45Accepted75ms384 KiB
46Accepted79ms376 KiB
47Accepted75ms384 KiB
48Accepted68ms356 KiB
49Accepted75ms384 KiB
50Accepted78ms504 KiB
51Accepted79ms360 KiB
52Accepted79ms384 KiB
53Accepted71ms356 KiB
54Accepted76ms528 KiB
55Accepted82ms356 KiB
56Accepted79ms668 KiB
57Accepted82ms504 KiB
58Accepted78ms384 KiB
59Accepted79ms512 KiB
subtask634.22/65
60Accepted3ms524 KiB
61Accepted1.483s436 KiB
62Accepted1.411s420 KiB
63Accepted1.414s540 KiB
64Accepted1.419s440 KiB
65Accepted1.34s384 KiB
66Accepted1.36s368 KiB
67Accepted4ms360 KiB
68Accepted4ms412 KiB
69Accepted4ms504 KiB
70Accepted4ms384 KiB
71Accepted4ms492 KiB
72Accepted28ms532 KiB
73Accepted56ms356 KiB
74Accepted17ms504 KiB
75Accepted17ms256 KiB
76Accepted17ms508 KiB
77Accepted17ms504 KiB
78Accepted17ms484 KiB
79Accepted14ms384 KiB
80Accepted16ms484 KiB
81Accepted17ms612 KiB
82Accepted17ms504 KiB
83Accepted17ms356 KiB
84Accepted16ms488 KiB
85Accepted16ms504 KiB
86Accepted18ms356 KiB
87Accepted20ms356 KiB
88Accepted17ms356 KiB
89Accepted82ms356 KiB
90Accepted86ms356 KiB
91Accepted79ms360 KiB
92Accepted78ms384 KiB
93Accepted86ms504 KiB
94Accepted81ms356 KiB
95Accepted82ms356 KiB
96Accepted83ms504 KiB
97Accepted81ms384 KiB
98Accepted82ms500 KiB
99Accepted82ms356 KiB
100Accepted82ms356 KiB
101Accepted79ms504 KiB
102Accepted82ms484 KiB
103Accepted87ms504 KiB
104Partially correct1.634s484 KiB
105Partially correct1.733s484 KiB
106Partially correct1.493s484 KiB
107Partially correct1.666s356 KiB
108Partially correct1.495s484 KiB
109Partially correct1.498s484 KiB
110Partially correct1.516s624 KiB
111Accepted1.567s484 KiB
112Accepted1.508s632 KiB
113Accepted1.549s420 KiB
114Partially correct1.455s420 KiB
115Partially correct1.501s632 KiB
116Partially correct1.43s420 KiB
117Partially correct1.634s628 KiB
118Partially correct1.472s536 KiB
119Partially correct1.396s492 KiB
120Partially correct1.442s356 KiB
121Partially correct1.677s484 KiB
122Partially correct1.534s484 KiB
123Partially correct1.771s632 KiB
124Partially correct1.694s512 KiB
125Partially correct1.539s484 KiB
126Partially correct1.455s484 KiB
127Partially correct1.478s656 KiB
128Partially correct1.475s612 KiB
129Partially correct1.481s484 KiB
130Partially correct1.434s484 KiB
131Partially correct1.623s356 KiB
132Partially correct1.465s424 KiB