QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#338212#5523. Graph Problem With Small $n$ERosIonCompile Error//C++143.5kb2024-02-25 19:12:222024-02-25 19:12:23

Judging History

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

  • [2024-02-25 19:12:23]
  • 评测
  • [2024-02-25 19:12:22]
  • 提交

answer

#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("-fwhole-program")
#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("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#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("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(2)


#include<cstdio>
#include<ctime>
#include<queue>
#include<algorithm>
#define R register
using namespace std;

const int MAXN = 25;

int n, e[MAXN];
int f[1 << MAXN];
int nx[1 << MAXN];
int nd[1 << MAXN];
int ans[MAXN], start;

char str[MAXN];
inline void read(R int t) {
	scanf ("%s", str);
	for (R int i = 0; i < n; ++ i)
		if (str[i] == '1')
			e[t] |= (1 << i);
}
inline void write(bool fg) {
	if (fg) putchar('1');
	else putchar('0');
}
queue<int>q;
inline void DP() {
	f[1] = 1; q.push(1); 
	nx[1] = e[1];
	while (!q.empty()) {
		R int u = q.front(); q.pop();
		R int nxt = nx[u] & ((1 << n) - u - 1);
		for (R int i = 1; i <= n; ++ i)
			if ((1 << (i - 1)) & nxt) {
				R int v = u | (1 << (i - 1));
				if (!f[v]) f[v] = 1, q.push(v);
				nx[v] |= e[i]; nd[v] |= (1 << (i - 1));
			}
	}
}
inline void Solve() {
	ans[1] = nd[(1 << n) - 1]; putchar('0');
	for (R int i = 2; i <= n; ++ i)
		if ((ans[1] >> (i - 1)) & 1)
			ans[i] = 1, putchar('1');
		else putchar('0');
	puts("");
	for (R int i = 2; i <= n; ++ i) {
		for (R int j = 1; j < (1 << n); ++ j)
			if ((j & 1) && (nd[j] & (1 << (i - 1))))
				ans[i] |= nd[(1 << n) - j];
		for (R int j = 1; j <= n; ++ j) {
			if (i == j) putchar('0');
			else write((ans[i] >> (j - 1)) & 1);
		}
		puts("");
	}
}

int main()
{
	start = clock();
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
	scanf ("%d", &n);
	for (int i = 1; i <= n; ++ i)
		read(i);
	DP(); Solve();
	printf ("%lf\n", 1. * (clock() - start) / CLOCKS_PER_SEC);
	return 0;
}

Details

answer.code:22:39: warning: bad option ‘-fwhole-program’ to pragma ‘optimize’ [-Wpragmas]
   22 | #pragma GCC optimize("-fwhole-program")
      |                                       ^
answer.code:29:41: warning: bad option ‘-fstrict-overflow’ to pragma ‘optimize’ [-Wpragmas]
   29 | #pragma GCC optimize("-fstrict-overflow")
      |                                         ^
answer.code:31:41: warning: bad option ‘-fcse-skip-blocks’ to pragma ‘optimize’ [-Wpragmas]
   31 | #pragma GCC optimize("-fcse-skip-blocks")
      |                                         ^
answer.code:45:51: warning: bad option ‘-funsafe-loop-optimizations’ to pragma ‘optimize’ [-Wpragmas]
   45 | #pragma GCC optimize("-funsafe-loop-optimizations")
      |                                                   ^
answer.code:67:25: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   67 | inline void read(R int t) {
      |                         ^
answer.code:67:25: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:67:25: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:67:25: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:26: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   73 | inline void write(bool fg) {
      |                          ^
answer.code:73:26: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:26: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:26: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:78:16: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   78 | inline void DP() {
      |                ^
answer.code:78:16: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:78:16: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:78:16: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:92:19: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   92 | inline void Solve() {
      |                   ^
answer.code:92:19: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:92:19: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:92:19: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:111:10: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
  111 | int main()
      |          ^
answer.code:111:10: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:111:10: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:111:10: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code: In function ‘int main()’:
answer.code:114:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  114 |         freopen("a.in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~
answer.code:115:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  115 |         freopen("a.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
answer.code:116:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  116 |         scanf ("%d", &n);
      |         ~~~~~~^~~~~~~~~~
answer.code: In function ‘void read(int)’:
answer.code:68:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   68 |         scanf ("%s", str);
      |         ~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/13/deque:63,
                 from /usr/include/c++/13/queue:62,
                 from answer.code:53:
/usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Deque_base<int, std::allocator<int> >::_Deque_impl::~_Deque_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/deque:66:
/usr/include/c++/13/bits/stl_deque.h:542:14: note: called from here
  542 |       struct _Deque_impl
      |              ^~~~~~~~~~~