QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#341101#7398. Triangle TilingSkyjoyCompile Error//C++144.6kb2024-02-29 15:42:162024-02-29 15:42:18

Judging History

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

  • [2024-02-29 15:42:18]
  • 评测
  • [2024-02-29 15:42:16]
  • 提交

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")
#include<bits/stdc++.h>
#define I using
#define love namespace
#define Elaina std
I love Elaina;
const int N=5010;
int read(){
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9'){
		x=(x<<3)+(x<<1)+ch-'0';
		ch=getchar();
	}
	return x*f;
}
int T,n,a[N][N],ans[N][N];
vector<int>pos[N],vec[N];
namespace AyaseEli{
	#define ls(k) (k<<1)
	#define rs(k) (k<<1|1)
	struct node{int l,r,maxn,tag;}tree[N<<2];
	void pushup(node *tree,int k){tree[k].maxn=max(tree[ls(k)].maxn,tree[rs(k)].maxn);}
	void pushtag(node *tree,int k,int v){tree[k].maxn+=v,tree[k].tag+=v;}
	void pushdown(node *tree,int k){
		if(tree[k].tag){
			pushtag(tree,ls(k),tree[k].tag),pushtag(tree,rs(k),tree[k].tag);
			tree[k].tag=0;
		}
	}
	void build(node *tree,int k,int l,int r){
		tree[k].l=l,tree[k].r=r,tree[k].tag=0;
		if(l==r){
			tree[k].maxn=l-1;
			return;
		}
		int mid=(l+r)/2;
		build(tree,ls(k),l,mid),build(tree,rs(k),mid+1,r);
		pushup(tree,k);
	}
	void change(node *tree,int k,int ql,int qr){
		if(ql<=tree[k].l&&tree[k].r<=qr){
			pushtag(tree,k,1);
			return;
		}
		pushdown(tree,k);
		int mid=(tree[k].l+tree[k].r)/2;
		if(ql<=mid)change(tree,ls(k),ql,qr);
		if(mid<qr)change(tree,rs(k),ql,qr);
		pushup(tree,k);
	}
	int query(node *tree,int k,int ql,int qr){
		int res=0;
		if(ql<=tree[k].l&&tree[k].r<=qr)return tree[k].maxn;
		pushdown(tree,k);
		int mid=(tree[k].l+tree[k].r)/2;
		if(ql<=mid)res=max(res,query(tree,ls(k),ql,qr));
		if(mid<qr)res=max(res,query(tree,rs(k),ql,qr));
		return res;
	}
}
I love AyaseEli;
void solve(){
	n=read();
	for(int i=1;i<=n;i++){
		pos[i].clear();
		for(int j=1;j<=i;j++){
			scanf("%1d",&a[i][j]);
			if(!a[i][j]){
				ans[i][j]=0;
				pos[i].push_back(j);
			}
			else ans[i][j]=-1;
		}
	}
	for(int i=n+1;i>1;i--){
		build(tree,1,1,i-1);
		if(pos[i].empty()&&i<=n){
			puts("Impossible!");
			return;
		}
		for(int j=1;j<i;j++)vec[j].clear();
		for(int j=1;j<i;j++)for(int tmp:pos[j])vec[i-1-j+tmp].push_back(tmp);
		for(int j=1,l=0,r=0;j<=i;j++){
			for(int tmp:vec[j])change(tree,1,1,tmp);
			if(!a[i][j]&&i<=n){
				a[i-1][r]=0,ans[i-1][r]=2;
				pos[i-1].push_back(r);
				for(int k=l+1;k<=r;k++)ans[i][k]=1;
				for(int k=r+1;k<j;k++)ans[i][k]=3;
				if(r)change(tree,1,1,r);
				l=r=j;
			}
			if(i==j){
				for(int k=l+1;k<=i;k++)ans[i][k]=1;
				break;
			}
			if(query(tree,1,1,j)>j){
				puts("Impossible!");
				return;
			}
			if(l&&query(tree,1,1,l)>=j)r=j+1;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++){
			if(ans[i][j])printf("%d",ans[i][j]);
			else putchar('-');
		}
		puts("");
	}
}
int main(){
	T=read();
	while(T--)solve();
	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:54:10: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   54 | int read(){
      |          ^
answer.code:54:10: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:54:10: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:54:10: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:37: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   73 |         void pushup(node *tree,int k){tree[k].maxn=max(tree[ls(k)].maxn,tree[rs(k)].maxn);}
      |                                     ^
answer.code:73:37: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:37: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:73:37: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:74:44: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   74 |         void pushtag(node *tree,int k,int v){tree[k].maxn+=v,tree[k].tag+=v;}
      |                                            ^
answer.code:74:44: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:74:44: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:74:44: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:75:39: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   75 |         void pushdown(node *tree,int k){
      |                                       ^
answer.code:75:39: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:75:39: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:75:39: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:81:48: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   81 |         void build(node *tree,int k,int l,int r){
      |                                                ^
answer.code:81:48: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:81:48: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:81:48: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:91:51: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   91 |         void change(node *tree,int k,int ql,int qr){
      |                                                   ^
answer.code:91:51: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:91:51: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:91:51: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:102:49: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
  102 |         int query(node *tree,int k,int ql,int qr){
      |                                                 ^
answer.code:102:49: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:102:49: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:102:49: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:113:12: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
  113 | void solve(){
      |            ^
answer.code:113:12: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:113:12: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:113:12: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:163:10: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
  163 | int main(){
      |          ^
answer.code:163:10: warning: bad option ‘-fstri...