Submission #582471

#TimeUsernameProblemLanguageResultExecution timeMemory
582471tutisArt Collections (BOI22_art)C++17
100 / 100
1715 ms664 KiB
/*input
1
3
1
3 1 2
1 3 2
*/
#include <bits/stdc++.h>
#include "art.h"
using namespace std;
// int publish(vector<int>v)
// {
// 	cout << "?";
// 	for (int i : v)
// 		cout << " " << i;
// 	cout << endl;
// 	int k;
// 	cin >> k;
// 	return k;
// }
// void answer(vector<int>v)
// {
// 	cout << "?";
// 	for (int i : v)
// 		cout << " " << i;
// 	cout << endl;
// }

void solve(int N)
{
	int ans[N];
	vector<int>P(N);
	for (int t = 0; t < N; t++)
	{
		for (int i = 0; i < N; i++)
			P[i] = (i + t) % N + 1;
		ans[t] = publish(P);
	}
	for (int i = 0; i < N; i++)
	{
		int del = ans[i] - ans[(i + 1) % N];
		//x k y
		//k xy      x
		//xy k      y
		//del = y - x
		//n-1 = x + y
		//n-1-del = x+y+x-y =2x
		int x = (N - 1 - del) / 2;
		P[N - 1 - x] = i + 1;
	}
	answer(P);
}

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...