#include <bits/stdc++.h>
#include "art.h"
using namespace std;
int n;
int try_it(int f, int s)
{
vector < int > rest;
for (int i = 1; i <= n; ++ i)
{
if(i == f || i == s)continue;
rest.push_back(i);
}
vector < int > fs, sf;
fs = rest;
fs.push_back(f);
fs.push_back(s);
int feedback1 = publish(fs);
sf = rest;
sf.push_back(s);
sf.push_back(f);
int feedback2 = publish(sf);
if(feedback1 < feedback2)
{
return 1;
}
else return 2;
}
vector < int > combine(vector < int > f, vector < int > s)
{
vector < int > res;
int i = 0;
int j = 0;
while(i < f.size() && j < s.size())
{
int el1 = f[i];
int el2 = s[j];
int order = try_it(el1, el2);
if(order == 1)
{
res.push_back(el1);
i ++;
}
else
{
res.push_back(el2);
j ++;
}
}
while(i < f.size())
{
res.push_back(f[i]);
i ++;
}
while(j < s.size())
{
res.push_back(s[j]);
j ++;
}
return res;
}
vector < int > merge_sort(int l, int r)
{
if(l == r)
{
vector < int > v;
v.push_back(l);
return v;
}
int mid = (l + r)/2;
vector < int > fh, sh;
fh = merge_sort(l, mid);
sh = merge_sort(mid+1, r);
return combine(fh, sh);
}
void solve(int N)
{
n = N;
vector < int > v = merge_sort(1, n);
answer(v);
return;
}
Compilation message
art.cpp: In function 'std::vector<int> combine(std::vector<int>, std::vector<int>)':
art.cpp:34:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | while(i < f.size() && j < s.size())
| ~~^~~~~~~~~~
art.cpp:34:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | while(i < f.size() && j < s.size())
| ~~^~~~~~~~~~
art.cpp:50:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | while(i < f.size())
| ~~^~~~~~~~~~
art.cpp:55:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | while(j < s.size())
| ~~^~~~~~~~~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
20 | if(v.size() != N) {
| ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | if(v.size() != N) {
| ~~~~~~~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
6 ms |
592 KB |
Output is correct |
10 |
Correct |
5 ms |
336 KB |
Output is correct |
11 |
Correct |
6 ms |
336 KB |
Output is correct |
12 |
Correct |
7 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
508 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
6 ms |
592 KB |
Output is correct |
10 |
Correct |
5 ms |
336 KB |
Output is correct |
11 |
Correct |
6 ms |
336 KB |
Output is correct |
12 |
Correct |
7 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
508 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
436 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
6 ms |
336 KB |
Output is correct |
23 |
Correct |
6 ms |
336 KB |
Output is correct |
24 |
Correct |
6 ms |
336 KB |
Output is correct |
25 |
Correct |
7 ms |
336 KB |
Output is correct |
26 |
Correct |
70 ms |
436 KB |
Output is correct |
27 |
Correct |
54 ms |
596 KB |
Output is correct |
28 |
Correct |
100 ms |
436 KB |
Output is correct |
29 |
Correct |
117 ms |
432 KB |
Output is correct |
30 |
Correct |
122 ms |
440 KB |
Output is correct |
31 |
Correct |
133 ms |
508 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
504 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
37 |
Correct |
1 ms |
336 KB |
Output is correct |
38 |
Correct |
6 ms |
440 KB |
Output is correct |
39 |
Correct |
4 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
6 ms |
592 KB |
Output is correct |
10 |
Correct |
5 ms |
336 KB |
Output is correct |
11 |
Correct |
6 ms |
336 KB |
Output is correct |
12 |
Correct |
7 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
508 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
436 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
6 ms |
336 KB |
Output is correct |
23 |
Correct |
6 ms |
336 KB |
Output is correct |
24 |
Correct |
6 ms |
336 KB |
Output is correct |
25 |
Correct |
7 ms |
336 KB |
Output is correct |
26 |
Correct |
70 ms |
436 KB |
Output is correct |
27 |
Correct |
54 ms |
596 KB |
Output is correct |
28 |
Correct |
100 ms |
436 KB |
Output is correct |
29 |
Correct |
117 ms |
432 KB |
Output is correct |
30 |
Correct |
122 ms |
440 KB |
Output is correct |
31 |
Correct |
133 ms |
508 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
504 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
37 |
Correct |
1 ms |
336 KB |
Output is correct |
38 |
Correct |
6 ms |
440 KB |
Output is correct |
39 |
Correct |
4 ms |
336 KB |
Output is correct |
40 |
Correct |
1 ms |
336 KB |
Output is correct |
41 |
Correct |
6 ms |
336 KB |
Output is correct |
42 |
Correct |
8 ms |
608 KB |
Output is correct |
43 |
Correct |
8 ms |
436 KB |
Output is correct |
44 |
Correct |
7 ms |
336 KB |
Output is correct |
45 |
Correct |
83 ms |
440 KB |
Output is correct |
46 |
Correct |
79 ms |
436 KB |
Output is correct |
47 |
Correct |
136 ms |
504 KB |
Output is correct |
48 |
Correct |
126 ms |
436 KB |
Output is correct |
49 |
Correct |
126 ms |
440 KB |
Output is correct |
50 |
Correct |
117 ms |
440 KB |
Output is correct |
51 |
Correct |
1 ms |
336 KB |
Output is correct |
52 |
Incorrect |
189 ms |
448 KB |
Not correct |
53 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
6 ms |
592 KB |
Output is correct |
10 |
Correct |
5 ms |
336 KB |
Output is correct |
11 |
Correct |
6 ms |
336 KB |
Output is correct |
12 |
Correct |
7 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
508 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
436 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
6 ms |
336 KB |
Output is correct |
23 |
Correct |
6 ms |
336 KB |
Output is correct |
24 |
Correct |
6 ms |
336 KB |
Output is correct |
25 |
Correct |
7 ms |
336 KB |
Output is correct |
26 |
Correct |
70 ms |
436 KB |
Output is correct |
27 |
Correct |
54 ms |
596 KB |
Output is correct |
28 |
Correct |
100 ms |
436 KB |
Output is correct |
29 |
Correct |
117 ms |
432 KB |
Output is correct |
30 |
Correct |
122 ms |
440 KB |
Output is correct |
31 |
Correct |
133 ms |
508 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
504 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
37 |
Correct |
1 ms |
336 KB |
Output is correct |
38 |
Correct |
6 ms |
440 KB |
Output is correct |
39 |
Correct |
4 ms |
336 KB |
Output is correct |
40 |
Correct |
1 ms |
336 KB |
Output is correct |
41 |
Correct |
6 ms |
336 KB |
Output is correct |
42 |
Correct |
8 ms |
608 KB |
Output is correct |
43 |
Correct |
8 ms |
436 KB |
Output is correct |
44 |
Correct |
7 ms |
336 KB |
Output is correct |
45 |
Correct |
83 ms |
440 KB |
Output is correct |
46 |
Correct |
79 ms |
436 KB |
Output is correct |
47 |
Correct |
136 ms |
504 KB |
Output is correct |
48 |
Correct |
126 ms |
436 KB |
Output is correct |
49 |
Correct |
126 ms |
440 KB |
Output is correct |
50 |
Correct |
117 ms |
440 KB |
Output is correct |
51 |
Correct |
1 ms |
336 KB |
Output is correct |
52 |
Incorrect |
189 ms |
448 KB |
Not correct |
53 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
6 ms |
592 KB |
Output is correct |
10 |
Correct |
5 ms |
336 KB |
Output is correct |
11 |
Correct |
6 ms |
336 KB |
Output is correct |
12 |
Correct |
7 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
1 ms |
508 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
336 KB |
Output is correct |
19 |
Correct |
4 ms |
336 KB |
Output is correct |
20 |
Correct |
4 ms |
436 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
6 ms |
336 KB |
Output is correct |
23 |
Correct |
6 ms |
336 KB |
Output is correct |
24 |
Correct |
6 ms |
336 KB |
Output is correct |
25 |
Correct |
7 ms |
336 KB |
Output is correct |
26 |
Correct |
70 ms |
436 KB |
Output is correct |
27 |
Correct |
54 ms |
596 KB |
Output is correct |
28 |
Correct |
100 ms |
436 KB |
Output is correct |
29 |
Correct |
117 ms |
432 KB |
Output is correct |
30 |
Correct |
122 ms |
440 KB |
Output is correct |
31 |
Correct |
133 ms |
508 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
504 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
37 |
Correct |
1 ms |
336 KB |
Output is correct |
38 |
Correct |
6 ms |
440 KB |
Output is correct |
39 |
Correct |
4 ms |
336 KB |
Output is correct |
40 |
Correct |
1 ms |
336 KB |
Output is correct |
41 |
Correct |
6 ms |
336 KB |
Output is correct |
42 |
Correct |
8 ms |
608 KB |
Output is correct |
43 |
Correct |
8 ms |
436 KB |
Output is correct |
44 |
Correct |
7 ms |
336 KB |
Output is correct |
45 |
Correct |
83 ms |
440 KB |
Output is correct |
46 |
Correct |
79 ms |
436 KB |
Output is correct |
47 |
Correct |
136 ms |
504 KB |
Output is correct |
48 |
Correct |
126 ms |
436 KB |
Output is correct |
49 |
Correct |
126 ms |
440 KB |
Output is correct |
50 |
Correct |
117 ms |
440 KB |
Output is correct |
51 |
Correct |
1 ms |
336 KB |
Output is correct |
52 |
Incorrect |
189 ms |
448 KB |
Not correct |
53 |
Halted |
0 ms |
0 KB |
- |