Submission #691012

# Submission time Handle Problem Language Result Execution time Memory
691012 2023-01-30T20:49:37 Z PagodePaiva Art Collections (BOI22_art) C++17
35 / 100
189 ms 428 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();

	while(l < r){
		int mid = (l+r) >> 1;
		if(mid == v.size()){
			l = v.size();
			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 < v.size();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

art.cpp: In function 'std::vector<int> busca(std::vector<int>, int)':
art.cpp:15:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |   if(mid == v.size()){
      |      ~~~~^~~~~~~~~~~
art.cpp:53:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |  for(int i = l;i < v.size();i++){
      |                ~~^~~~~~~~~~
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 288 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 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 1 ms 288 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 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 4 ms 208 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 4 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 208 KB Output is correct
20 Correct 3 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 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 4 ms 208 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 4 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 208 KB Output is correct
20 Correct 3 ms 336 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 4 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 4 ms 304 KB Output is correct
25 Correct 4 ms 208 KB Output is correct
26 Correct 98 ms 428 KB Output is correct
27 Correct 99 ms 208 KB Output is correct
28 Correct 105 ms 296 KB Output is correct
29 Correct 100 ms 420 KB Output is correct
30 Correct 116 ms 312 KB Output is correct
31 Correct 101 ms 428 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 212 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 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 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 4 ms 208 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 4 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 208 KB Output is correct
20 Correct 3 ms 336 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 4 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 4 ms 304 KB Output is correct
25 Correct 4 ms 208 KB Output is correct
26 Correct 98 ms 428 KB Output is correct
27 Correct 99 ms 208 KB Output is correct
28 Correct 105 ms 296 KB Output is correct
29 Correct 100 ms 420 KB Output is correct
30 Correct 116 ms 312 KB Output is correct
31 Correct 101 ms 428 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 212 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 208 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 5 ms 308 KB Output is correct
42 Correct 3 ms 212 KB Output is correct
43 Correct 7 ms 304 KB Output is correct
44 Correct 7 ms 296 KB Output is correct
45 Correct 106 ms 308 KB Output is correct
46 Correct 128 ms 292 KB Output is correct
47 Correct 100 ms 420 KB Output is correct
48 Correct 92 ms 304 KB Output is correct
49 Correct 107 ms 304 KB Output is correct
50 Correct 92 ms 296 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 189 ms 320 KB Not correct
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 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 4 ms 208 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 4 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 208 KB Output is correct
20 Correct 3 ms 336 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 4 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 4 ms 304 KB Output is correct
25 Correct 4 ms 208 KB Output is correct
26 Correct 98 ms 428 KB Output is correct
27 Correct 99 ms 208 KB Output is correct
28 Correct 105 ms 296 KB Output is correct
29 Correct 100 ms 420 KB Output is correct
30 Correct 116 ms 312 KB Output is correct
31 Correct 101 ms 428 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 212 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 208 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 5 ms 308 KB Output is correct
42 Correct 3 ms 212 KB Output is correct
43 Correct 7 ms 304 KB Output is correct
44 Correct 7 ms 296 KB Output is correct
45 Correct 106 ms 308 KB Output is correct
46 Correct 128 ms 292 KB Output is correct
47 Correct 100 ms 420 KB Output is correct
48 Correct 92 ms 304 KB Output is correct
49 Correct 107 ms 304 KB Output is correct
50 Correct 92 ms 296 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 189 ms 320 KB Not correct
53 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 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 4 ms 208 KB Output is correct
10 Correct 4 ms 208 KB Output is correct
11 Correct 4 ms 208 KB Output is correct
12 Correct 4 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 1 ms 208 KB Output is correct
15 Correct 1 ms 208 KB Output is correct
16 Correct 0 ms 208 KB Output is correct
17 Correct 1 ms 208 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 6 ms 208 KB Output is correct
20 Correct 3 ms 336 KB Output is correct
21 Correct 0 ms 208 KB Output is correct
22 Correct 4 ms 208 KB Output is correct
23 Correct 4 ms 208 KB Output is correct
24 Correct 4 ms 304 KB Output is correct
25 Correct 4 ms 208 KB Output is correct
26 Correct 98 ms 428 KB Output is correct
27 Correct 99 ms 208 KB Output is correct
28 Correct 105 ms 296 KB Output is correct
29 Correct 100 ms 420 KB Output is correct
30 Correct 116 ms 312 KB Output is correct
31 Correct 101 ms 428 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 212 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 208 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 5 ms 308 KB Output is correct
42 Correct 3 ms 212 KB Output is correct
43 Correct 7 ms 304 KB Output is correct
44 Correct 7 ms 296 KB Output is correct
45 Correct 106 ms 308 KB Output is correct
46 Correct 128 ms 292 KB Output is correct
47 Correct 100 ms 420 KB Output is correct
48 Correct 92 ms 304 KB Output is correct
49 Correct 107 ms 304 KB Output is correct
50 Correct 92 ms 296 KB Output is correct
51 Correct 1 ms 208 KB Output is correct
52 Incorrect 189 ms 320 KB Not correct
53 Halted 0 ms 0 KB -