QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#616312#3294. 网格DengDuckCompile Error//C++144.2kb2024-10-06 01:37:372024-10-06 01:37:38

Judging History

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

  • [2024-10-06 01:37:38]
  • 评测
  • [2024-10-06 01:37:37]
  • 提交

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<bits/stdc++.h>
#define LL long long
#define pII pair<int,int>
#define Fi first
#define Se second
#define pb push_back
using namespace std;
const int N=4e5+5;
const int Dx[8]={0,0,1,-1,1,1,-1,-1};
const int Dy[8]={1,-1,0,0,-1,1,-1,1};
int n,m,c,TOT,Sz[N],Fa[N];
LL V,E,R;
inline int Fd(int x)
{
	if(Fa[x]==x)return x;
	return Fd(Fa[x]);
}
map<pII,int>Ma,Nam;
vector<pII>St;
pII P[N];
inline bool In(int x,int y)
{
	return 1<=x&&x<=n&&1<=y&&y<=m;
}
inline int Num(int x,int y)
{
	if(!In(x,y)||x==n||y==m)return 0;
	if(Nam[{x,y}])return Nam[{x,y}];
	Nam[{x,y}]=++TOT,Fa[TOT]=TOT,Sz[TOT]=1;
	return TOT;
}
inline void Mrg(int x,int y,int op=0)
{
	x=Fd(x),y=Fd(y);
	if(x==y)return;
	if(Sz[x]<Sz[y])swap(x,y);
	if(op)St.pb({x,y});
	Fa[y]=x,Sz[x]+=Sz[y];
	R--;
}
inline void Rd(int &s)
{
	s=0;char ch=getchar();
	while(ch<'0'||ch>'9'){ch=getchar();}
	while(ch>='0'&&ch<='9'){s=(s<<3)+(s<<1)+(ch-'0');ch=getchar();}
}
inline void Work()
{
	Rd(n),Rd(m),Rd(c);
	TOT=0,Sz[0]=1,Fa[0]=0;
	St.clear(),Ma.clear(),Nam.clear();
	V=1ll*n*m,E=1ll*(n-1)*m+1ll*n*(m-1),R=1ll*(n-1)*(m-1)+1;
	for(int i=1,x,y;i<=c;i++)
	{
		Rd(x),Rd(y);
		Ma[{x,y}]=1,V--;
		for(int j=0;j<4;j++)
		{
			int X=x+Dx[j],Y=y+Dy[j];
			if(In(X,Y)&&!Ma[{X,Y}])E--;
		}
		Mrg(Num(x-1,y),Num(x,y));
		Mrg(Num(x,y-1),Num(x,y));
		Mrg(Num(x-1,y-1),Num(x-1,y));
		P[i]={x,y};
	}
	if(V-E+R>2)return puts("0"),void();
	if(V<=2)return puts("-1"),void();
	if(n==1||m==1)return puts("1"),void();
	for(int i=1;i<=c;i++)
	{
		for(int j=0;j<8;j++)
		{
			int x=P[i].Fi+Dx[j],y=P[i].Se+Dy[j];
			if(!In(x,y)||Ma[{x,y}])continue;
			--V;
			LL E2=E;
			for(int j=0;j<4;j++)
			{
				int X=x+Dx[j],Y=y+Dy[j];
				if(In(X,Y)&&!Ma[{X,Y}])E--;
			}
			int Cnt=TOT;
			Mrg(Num(x-1,y),Num(x,y),1);
			Mrg(Num(x,y-1),Num(x,y),1);
			Mrg(Num(x-1,y-1),Num(x-1,y),1);
			if(V-E+R>2)return puts("1"),void();
			while(!St.empty())
			{
				pII t=St.back();St.pop_back();
				++R;
				Fa[t.Se]=t.Se,Sz[t.Fi]-=Sz[t.Se];
			}
			if(Num(x-1,y)>Cnt)Nam[{x-1,y}]=0;
			if(Num(x,y-1)>Cnt)Nam[{x,y-1}]=0;
			if(Num(x-1,y-1)>Cnt)Nam[{x-1,y-1}]=0;
			if(Num(x,y)>Cnt)Nam[{x,y}]=0;
			E=E2,V++,TOT=Cnt;
		}
	}
	puts("2");
}
int main()
{
	int T;Rd(T);
	while(T--){Work();}
}

详细

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:61:20: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   61 | inline int Fd(int x)
      |                    ^
answer.code:61:20: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:61:20: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:61:20: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:69:27: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   69 | inline bool In(int x,int y)
      |                           ^
answer.code:69:27: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:69:27: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:69:27: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:27: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   73 | inline int Num(int x,int y)
      |                           ^
answer.code:73:27: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:27: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:27: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:80:37: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   80 | inline void Mrg(int x,int y,int op=0)
      |                                     ^
answer.code:80:37: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:80:37: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:80:37: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:89:22: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   89 | inline void Rd(int &s)
      |                      ^
answer.code:89:22: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:89:22: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:89:22: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:95:18: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   95 | inline void Work()
      |                  ^
answer.code:95:18: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:95:18: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:95:18: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:151:10: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
  151 | int main()
      |          ^
answer.code:151:10: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:151:10: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:151:10: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
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:49:
/usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Rb_tree<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::_Select1st<std::pair<const std::pair<int, int>, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<const std::pair<int, int>, int> > >::_Rb_tree_impl<std::less<std::pair<int, int> >, true>::~_Rb_tree_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 = std::_Rb_tree_node<std::pair<const std::pair<int, int>, int> >]’: target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/1...