Submission #807692

# Submission time Handle Problem Language Result Execution time Memory
807692 2023-08-04T21:34:10 Z Juan Art Collections (BOI22_art) C++17
0 / 100
1 ms 208 KB
#include<bits/stdc++.h>
#include "art.h"
using namespace std;

int ask(int x, int n){
	vector<int> v;
	v.push_back(x);
	for(int i = 1; i <= n; i++) if(i!=x) v.push_back(i);
	publish(v);
	int rt; cin >> rt;
	return rt;
}

void insrt(vector<int> &v, int x, int p){
	vector<int> aux;
	for(int i = 0; i < p; i++) aux.push_back(v[i]);
	aux.push_back(x);
	for(int i = p; i < v.size(); i++) aux.push_back(v[i]);
	swap(v, aux);
}

void solve(int n){
	vector<int> ans;

	int B = ask(1, n);
	ans.push_back(1);
	for(int i = 2; i <= n; i++){
		// int x = ask(i);
		// int antes = (i-1-B+x)/2;
		// insrt(ans, i, antes);
		insrt(ans, i, (i-1-B+ask(i,n))/2);
	}

	answer(ans);
}

Compilation message

art.cpp: In function 'void insrt(std::vector<int>&, int, int)':
art.cpp:18:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for(int i = p; i < v.size(); i++) aux.push_back(v[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 Execution timed out 1 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1 ms 208 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -