Submission #691016

# Submission time Handle Problem Language Result Execution time Memory
691016 2023-01-30T20:52:42 Z PagodePaiva Art Collections (BOI22_art) C++17
35 / 100
174 ms 424 KB
#include<bits/stdc++.h>
#include "art.h"
#define pb push_back
#define all(v) v.begin(), v.end()

using namespace std;

int n;

vector <int> busca(vector <int> v, int k){
	int l = 0, r = v.size();
	int t = v.size();
	while(l < r){
		int mid = (l+r) >> 1;
		if(mid == t){
			l = t;
			break;
		}

		vector <int> aux;

		aux.pb(k);
		aux.pb(v[mid]);

		for(int i = 1;i <= n;i++){
			if(i == k or i == v[mid]) continue;
			aux.pb(i);
		}

		int x = publish(aux);
		aux[0] = v[mid];
		aux[1] = k;
		int y = publish(aux);

		if(x > y){
			// v[mid] > k
			r = mid;
		}

		else{
			l = mid+1;
		}
	}

	vector <int> res;

	for(int i = 0;i < l;i++){
		res.pb(v[i]);
	}

	res.pb(k);

	for(int i = l;i < t;i++){
		res.pb(v[i]);
	}

	return res;
}

void solve(int N){
	n = N;
	vector <int> v;
	v.pb(1);

	for(int i = 2;i <= n;i++){
		v = busca(v, i);
	}

	reverse(all(v));

	answer(v);

	return;
}

Compilation message

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 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 304 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 304 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 5 ms 300 KB Output is correct
23 Correct 4 ms 300 KB Output is correct
24 Correct 5 ms 208 KB Output is correct
25 Correct 6 ms 300 KB Output is correct
26 Correct 105 ms 280 KB Output is correct
27 Correct 98 ms 292 KB Output is correct
28 Correct 98 ms 424 KB Output is correct
29 Correct 102 ms 312 KB Output is correct
30 Correct 91 ms 412 KB Output is correct
31 Correct 99 ms 312 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 1 ms 208 KB Output is correct
38 Correct 5 ms 208 KB Output is correct
39 Correct 3 ms 296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 304 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 5 ms 300 KB Output is correct
23 Correct 4 ms 300 KB Output is correct
24 Correct 5 ms 208 KB Output is correct
25 Correct 6 ms 300 KB Output is correct
26 Correct 105 ms 280 KB Output is correct
27 Correct 98 ms 292 KB Output is correct
28 Correct 98 ms 424 KB Output is correct
29 Correct 102 ms 312 KB Output is correct
30 Correct 91 ms 412 KB Output is correct
31 Correct 99 ms 312 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 1 ms 208 KB Output is correct
38 Correct 5 ms 208 KB Output is correct
39 Correct 3 ms 296 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 4 ms 208 KB Output is correct
42 Correct 6 ms 208 KB Output is correct
43 Correct 5 ms 300 KB Output is correct
44 Correct 4 ms 208 KB Output is correct
45 Correct 104 ms 292 KB Output is correct
46 Correct 94 ms 312 KB Output is correct
47 Correct 87 ms 408 KB Output is correct
48 Correct 99 ms 208 KB Output is correct
49 Correct 85 ms 316 KB Output is correct
50 Correct 101 ms 292 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 174 ms 320 KB Not correct
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 304 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 5 ms 300 KB Output is correct
23 Correct 4 ms 300 KB Output is correct
24 Correct 5 ms 208 KB Output is correct
25 Correct 6 ms 300 KB Output is correct
26 Correct 105 ms 280 KB Output is correct
27 Correct 98 ms 292 KB Output is correct
28 Correct 98 ms 424 KB Output is correct
29 Correct 102 ms 312 KB Output is correct
30 Correct 91 ms 412 KB Output is correct
31 Correct 99 ms 312 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 1 ms 208 KB Output is correct
38 Correct 5 ms 208 KB Output is correct
39 Correct 3 ms 296 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 4 ms 208 KB Output is correct
42 Correct 6 ms 208 KB Output is correct
43 Correct 5 ms 300 KB Output is correct
44 Correct 4 ms 208 KB Output is correct
45 Correct 104 ms 292 KB Output is correct
46 Correct 94 ms 312 KB Output is correct
47 Correct 87 ms 408 KB Output is correct
48 Correct 99 ms 208 KB Output is correct
49 Correct 85 ms 316 KB Output is correct
50 Correct 101 ms 292 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 174 ms 320 KB Not correct
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 3 ms 296 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 5 ms 208 KB Output is correct
13 Correct 1 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 0 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 304 KB Output is correct
20 Correct 3 ms 208 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 5 ms 300 KB Output is correct
23 Correct 4 ms 300 KB Output is correct
24 Correct 5 ms 208 KB Output is correct
25 Correct 6 ms 300 KB Output is correct
26 Correct 105 ms 280 KB Output is correct
27 Correct 98 ms 292 KB Output is correct
28 Correct 98 ms 424 KB Output is correct
29 Correct 102 ms 312 KB Output is correct
30 Correct 91 ms 412 KB Output is correct
31 Correct 99 ms 312 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 0 ms 208 KB Output is correct
35 Correct 1 ms 208 KB Output is correct
36 Correct 1 ms 208 KB Output is correct
37 Correct 1 ms 208 KB Output is correct
38 Correct 5 ms 208 KB Output is correct
39 Correct 3 ms 296 KB Output is correct
40 Correct 0 ms 208 KB Output is correct
41 Correct 4 ms 208 KB Output is correct
42 Correct 6 ms 208 KB Output is correct
43 Correct 5 ms 300 KB Output is correct
44 Correct 4 ms 208 KB Output is correct
45 Correct 104 ms 292 KB Output is correct
46 Correct 94 ms 312 KB Output is correct
47 Correct 87 ms 408 KB Output is correct
48 Correct 99 ms 208 KB Output is correct
49 Correct 85 ms 316 KB Output is correct
50 Correct 101 ms 292 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 174 ms 320 KB Not correct
53 Halted 0 ms 0 KB -