Submission #344998

# Submission time Handle Problem Language Result Execution time Memory
344998 2021-01-06T21:13:26 Z _ani Bootfall (IZhO17_bootfall) C++17
Compilation error
0 ms 0 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>
using namespace std;
const int N = 370;
vector<int> a, ans;
int SUM;
bitset<N* N> dp[N + 1][N + 1];
bitset<N* N> hrashq[N + 1];
int isok[N * N];
int main()
{
	int n;
	cin >> n;
	a.resize(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		SUM += a[i];
	}
	bool skzb = false;
	for (int jnj = 0; jnj < n; jnj++) {
		auto b = a;
		b.erase(b.begin() + jnj);
		for (int i = 0; i < n - 1; i++) {
			if (i - 1 < 0)
				dp[jnj][i][0] = dp[jnj][i][b[i]] = 1;
			else dp[jnj][i] = ((dp[jnj][i - 1] << b[i]) | dp[jnj][i - 1]);
		}
	}
	for (int jnj = 0; jnj < n; jnj++)
	{
		for (int i = 0; i < n - 1; i++)
			hrashq[jnj] |= dp[jnj][i];
		if (hrashq[jnj][SUM / 2])skzb = true;
	}
	if (SUM % 2)skzb = false;
	for (int i = 1; i <= N * N; i++) {
		bool ok = true;
		int cs = i + SUM;
		for (int jnj = 0; jnj < n; jnj++) {
			int ccs = cs - a[jnj];
			if (ccs > N * N) {
				ok = false;
				break;
			}
			if (!hrashq[jnj][ccs / 2])
				ok = false;
			if (ccs % 2)ok = false;
		}
		if (ok && skzb)ans.push_back(i);
	}
	cout << ans.size() << '\n';
	for (int a : ans)
		cout << a << ' ';
	return 0;
}

Compilation message

/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status