Submission #1121280

#TimeUsernameProblemLanguageResultExecution timeMemory
1121280vjudge1Art Collections (BOI22_art)C++17
0 / 100
1 ms336 KiB
#include<bits/stdc++.h>
#include "art.h"
using namespace std;
vector <int> v;
vector <int> ans;
// int publish(vector <int> v) {
// 	cout << "publish({";
// 	int x;
// 	for(auto to : v) cout << to << " ";
// 	cout << "})" << endl;
// 	cin >> x;
// 	return x;
// }
// void answer(vector <int> v) {
// 	cout << "answer({";
// 	for(auto to : v) {
// 		if(to != 0) cout << to << " ";
// 	}
// 	cout << "})" << endl;
// }
void solve(int n) {
// 	int n;
// 	cin >> n;
	ans.resize(n);
	vector <int> v, v2;
	for(int i = 1; i <= n; i++) {
		v.push_back(i);
	}
	int res = publish(v);
	if(res == 0) {
		answer(v);
		return;
	}
	v.clear();
//cout << res << '\n';
	for(int i = 1; i < n; i++) {
		vector <int> v2;
		//cout << i << endl;
		for(int j = i + 1; j <= n; j++) {
			v2.push_back(j);
		}
		for(int j = 1; j <= i; j++) {
			v2.push_back(j);
		}
		int cur = publish(v2);
		int A = res, B = cur;
		int d = (A + B - n + 1) / 2;
		ans[i] = A - d + 1;
		//cout << i << " " << A << " " << B << " " << d << " " << A - d + 1 << " " << endl;
		v = v2;
		res = cur;
	}
	for(int i = 1; i <= n; i++) {
		if(ans[i] == 0) ans[i] = n;
	}
	answer(ans);
}
// signed main() {
// 	solve();
// }

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...