QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#406501#4811. Be CarefullexiyvvCompile Error//C++204.1kb2024-05-07 13:01:422024-05-07 13:01:42

Judging History

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

  • [2024-05-07 13:01:42]
  • 评测
  • [2024-05-07 13:01:42]
  • 提交

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("-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")
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define int long long
#define __int128 int
using namespace std;
const int mod=998244353;
int n,p1,p2,dp[205][205],lf[205];
int qpow[205][205],f[205],g[205],C[205][205],q[205][205];
__int128 fm2[205];
vector<int>v[205];
#define R 1
int F[205][(1<<R)+5],G[205][(1<<R)+5],t[205];
unordered_map<int,int>mp;
//const int mod2=1000000000000009;
void dfs(int x,int l){
	int tg=0,cnt2=0;
	for(auto y:v[x])
		if(y!=l)dfs(y,x),tg=1,cnt2++;
	if(!tg){
		lf[x]=1;
		return ;
	}
	vector<pair<__int128,int> >f,g;
	f.push_back({0,1});
	int cnt=0;
	int lim=cnt2+1;
	for(auto y:v[x]){
		if(y==l)continue;
		if(lf[y]){
			cnt++;
			continue;
		}
	}
	lim=min(lim,(int)(sqrt((n-cnt)*2)+0.1)+cnt);
//	if(x==1)return ;
//	if(n>150)lim=min(lim,27ll);
	sort(v[x].begin(),v[x].end(),[&](int x,int y){return v[x].size()<v[y].size();});
	for(auto y:v[x]){
		if(y==l)continue;
		if(lf[y]){
			continue;
		}
		g.clear();
		for(int j=0;j<=n;j++)
			if(dp[y][j]!=0)
				for(auto i:f)
				g.push_back({i.first|fm2[min(j,lim)],i.second*dp[y][j]%mod});
		for(auto i:g)(mp[i.first]+=i.second)%=mod;
		f.clear();
		for(auto i:g){
			int r=mp[i.first];
			if(r)f.push_back({i.first,r}),mp[i.first]=0;
		}
	}
	for(auto i:f){
		int a=i.first,w=i.second;
		int c=0;
		for(int j=0;j<=n;j++){
			if(!(a&fm2[j]))
			(dp[x][j]+=w*q[j-c][cnt])%=mod;
			else c++;
		}
	}
}
int p[205];
signed main(){
//	freopen("tree.in","r",stdin);
//	freopen("tree.out","w",stdout);
	cin>>n;
	fm2[0]=1;
	for(int i=1;i<=n/2+1;i++)fm2[i]=fm2[i-1]*2;
	f[0]=1;
	for(int i=0;i<=n;i++){
		int mul=1;
		for(int j=0;j<=n;j++){
			qpow[i][j]=mul;
			(mul*=i)%=mod;
		}
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=i;j++){
			if(j==0||j==i)C[i][j]=1;
			else C[i][j]=(C[i-1][j]+C[i-1][j-1])%mod;
		}
	}
	for(int j=0;j<=n;j++){
		for(int k=0;j+k<=n;k++)
		(q[0][j+k]+=f[j]*qpow[n][k]%mod*C[j+k][k])%=mod;
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			for(int k=1;j+k<=n;k++)
			(g[j+k]+=f[j]*C[j+k][k])%=mod;
		}
		memcpy(f,g,sizeof(f));memset(g,0,sizeof(g));
		for(int j=0;j<=n;j++){
			for(int k=0;j+k<=n;k++)
			(q[i+1][j+k]+=f[j]*qpow[n-i-1][k]%mod*C[j+k][k])%=mod;
		}
	}
	for(int i=1;i<n;i++){
		cin>>p1>>p2;
		v[p1].push_back(p2);
		v[p2].push_back(p1);
	}
	dfs(1,0);
	for(int i=0;i<=n;i++)
	cout<<dp[1][i]<<endl;
	return 0;
}

详细

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:45:
/usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Vector_base<long long int, std::allocator<long long int> >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long long int]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~