Submission #703933

# Submission time Handle Problem Language Result Execution time Memory
703933 2023-03-01T03:34:08 Z Chal1shkan Art Collections (BOI22_art) C++17
0 / 100
0 ms 336 KB
# include <bits/stdc++.h>
# include <art.h>

# define pb push_back
# define ff first
# define ss second
# define nl "\n"
# define sz(x) ((int)(x).size())
# define deb(x) cerr << #x  << " = " << x << endl; 
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
const ll maxn = 2e5 + 25;
const ll inf = 2e9 + 0;
const ll mod = 998244353;
const ll dx[] = {-1, 1, 0, 0};
const ll dy[] = {0, 0, -1, 1};
 
using namespace std;

vector <int> g[4003];
vector <int> ord;
bool used[4003];

void dfs (int v)
{
	ord.pb(v);
	used[v] = 1;
	for (int to : g[v])
	{
		if (!used[to])
		{
			dfs(to);
		}
	}
}

void solve (int N)
{
	int n = N;
	vector <int> v;
	for (int i = 1; i <= n; ++i) v.pb(i);
	int cnt = publish(v);
	ll st = -1;
	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			if (i == j) continue;
			swap(v[i], v[j]);
			int cur = publish(v);
			if (cur == cnt + 1)
			{
				g[v[i]].pb(v[j]);
				st = v[i];
			}
			swap(v[i], v[j]);
		}
	}
	dfs(st);
	answer(ord);	
}

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 Incorrect 0 ms 336 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 336 KB Not correct
2 Halted 0 ms 0 KB -