QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#742144#8790. First Billionzhenghanyun#Compile Error//C++143.7kb2024-11-13 15:58:232024-11-13 15:58:23

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 15:58:23]
  • 评测
  • [2024-11-13 15:58:23]
  • 提交

answer

#pragma GCC optimize(0)
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma GCC target("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 105;
const int M = 350377;
const int R = 24042;

mt19937_64 rng(chrono::steady_clock().now().time_since_epoch().count());

int TS, n, a0[N], a[N], p[N], f[N][M + 5], g[N][M + 5];

vector <int> ans;

inline bool dfs(int dep, int cnt, int k) {
	if (cnt > (n >> 1)) {
		return false;
	}
	++TS;
	if (dep == 0 || cnt == (n >> 1)) {
		int sum = 0;
		for (auto u: ans) {
			sum += a[u];
		}
		if (sum == 1e9) {
			return true;
		}
		return false;
	}
	int t = (M - a[dep] % M) % M;
	if (g[dep][k] & 2) {
		ans.emplace_back(dep);
		if (dfs(dep - 1, cnt + 1, (k + t) % M)) {
			return true;
		}
		ans.pop_back();
	}
	if (TS > 2e7) {
		return false;
	}
	if (g[dep][k] & 1) {
		if (dfs(dep - 1, cnt, k)) {
			return true;
		}
	}
	return false;
}

int main() {
	#ifdef LOCAL
		assert(freopen("test.in", "r", stdin));
		assert(freopen("test.out", "w", stdout));
	#endif
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> a0[i];
		p[i] = i;
	}
	while (true) {
		memset(f, 0, sizeof(f));
		memset(g, 0, sizeof(g));
		shuffle(p + 1, p + n + 1, rng);
		for (int i = 1; i <= n; ++i) {
			a[i] = a0[p[i]];
		}
		f[0][0] = 1;
		for (int i = 1; i <= n; ++i) {
			int t = a[i] % M;
			for (int j = 0; j < M; ++j) {
				f[i][j] = f[i - 1][j];
				if (f[i][j]) {
					g[i][j] = 1;
				}
			}
			for (int j = 0; j < M; ++j) {
				int k = (j + t) % M;
				if (f[i - 1][j]) {
					f[i][k] = 1;
					g[i][k] += 2;
				}
			}
		}
		TS = 0;
		if (!dfs(n, 0, R)) {
			continue;
		}
		cout << ans.size() << "\n";
		for (auto &u: ans) {
			u = p[u];
		}
		sort(ans.begin(), ans.end());
		for (auto u: ans) {
			cout << u << " ";
		}
		cout << "\n";
		break;
	}
	return 0;
}

Details

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from answer.code:47:
/usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/queue:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:157:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~