QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#580072#7398. Triangle TilingCrysflyCompile Error//C++145.5kb2024-09-21 19:58:032024-09-21 19:58:03

Judging History

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

  • [2024-09-21 19:58:03]
  • 评测
  • [2024-09-21 19:58:03]
  • 提交

answer

// what is matter? never mind. 
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#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 target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2") 
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
//#define int long long
using namespace std;
inline int read()
{
    char c=getchar();int x=0;bool f=0;
    for(;!isdigit(c);c=getchar())f^=!(c^45);
    for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
    if(f)x=-x;return x;
}

namespace out{
    char buffer[1<<21];int p1=-1;const int p2 = (1<<21)-1;
    inline void flush(){fwrite(buffer,1,p1+1,stdout),p1=-1;}
    inline void putc(const char &x) {if(p1==p2)flush();buffer[++p1]=x;}
    template <typename T>void write(T x) {
        static char buf[15];static int len=-1;if(x>=0){do{buf[++len]=x%10+48,x/=10;}while (x);}else{putc('-');do {buf[++len]=-(x%10)+48,x/=10;}while(x);}
        while (len>=0)putc(buf[len]),--len;
    }
    void out(string &s){
    	for(auto c:s)putc(c);
	}
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
 
#define maxn 5005
#define inf 0x3f3f3f3f

int n,a[maxn][maxn],b[maxn][maxn];
char s[maxn];

int mx[maxn<<2],tag[maxn<<2];
void build(int p,int l,int r){
	tag[p]=0,mx[p]=r;
	if(l==r)return;
	int mid=l+r>>1;
	build(p<<1,l,mid),build(p<<1|1,mid+1,r);
}
void add(int p,int l,int r,int nr){
	if(r<=nr)return tag[p]+=1,mx[p]+=1,void();
	int mid=l+r>>1;
	add(p<<1,l,mid,nr);
	if(nr>mid)add(p<<1|1,mid+1,r,nr);
	mx[p]=max(mx[p<<1],mx[p<<1|1])+tag[p];
}
int ask(int p,int l,int r,int qr){
	if(r<=qr)return mx[p];
	int mid=l+r>>1,res=ask(p<<1,l,mid,qr);
	if(qr>mid)res=max(res,ask(p<<1|1,mid+1,r,qr));
	return res+tag[p];
}

vi vec[maxn];
int p[maxn],len;

bool work(int O)
{
	n=read();
	int cz=0;
	For(i,1,n){
		For(j,1,i){
			char ch;
			while(!isdigit(ch=getchar()));
			a[i][j]=ch&1,b[i][j]=0;
			if(!a[i][j])++cz;
		}
	}
	if(0&&O==13){
		cout<<n<<"\n";
		For(i,1,n){
			For(j,1,i)cout<<a[i][j];puts("");
		}puts("");exit(0);
	}
	assert(cz==n);
	For(i,1,n)vec[i].clear();
	For(i,1,n)For(j,1,i)
		if(!a[i][j])vec[i-j+1].pb(j);
	Rep(i,n,2){
	//	cout<<"chk "<<i<<"\n";
		len=0;
		For(j,1,i)
			if(!a[i][j] || b[i][j]==2) p[++len]=j;
	//	cout<<"p: ";For(j,1,len)cout<<p[j]<<" "; cout<<"\n";
		if(!len) return 0;
		For(j,1,i)
			if(!a[i][j])vec[i-j+1].pop_back();
		For(j,1,p[1]-1) b[i][j]=3;
		For(j,p[len]+1,i) b[i][j]=1;
		build(1,1,i);
		int now=-1,pos=0;
		
		
		if(!a[i][1]||b[i][1]==2) add(1,1,i,1);
	//	else add(1,1,i,1,1,-1);
		For(j,1,i-1){
			if(j==p[1]) now=2,pos=j;
			
			if(!a[i][j+1]||b[i][j+1]==2) add(1,1,i,j+1);
		//	else add(1,1,i,1,j+1,-1);
			
			for(int x:vec[i-j]){
				add(1,1,i,x);
			}
			
			int O=j+2;
			if(ask(1,1,i,j+1)>O) return 0;
		
		//	cout<<"POS "<<pos<<"\n";
			if(pos && now<=len && j+1==p[now]){
				if(pos==j+1) return 0;
				b[i-1][pos]=2;
				For(x,p[now-1]+1,pos) b[i][x]=1;
				For(x,pos+1,p[now]-1) b[i][x]=3;
				pos=p[now];
				++now;
			}
			if(pos && ask(1,1,i,pos+1)==O)pos=j+1;
		}
	}
	
	For(i,1,n){
		For(j,1,i)out::putc("-123"[b[i][j]]);
		out::putc('\n');
	}
	return 1;
}

signed main()
{
//	freopen("my.out","w",stdout);
	int T=read();
	string qwq="Impossible!";
	For(_,1,T)if(!work(_))out::out(qwq),out::putc('\n');
	out::flush();
    return 0;
}
/*
1
4
1
01
110
1100


1
6
1
11
111
1011
11010
010110

1
8
1
11
111
1011
11010
011110
1101110
01111111

-
-1
332
33--
*/

详细

answer.code:26:39: warning: bad option ‘-fwhole-program’ to pragma ‘optimize’ [-Wpragmas]
   26 | #pragma GCC optimize("-fwhole-program")
      |                                       ^
answer.code:33:41: warning: bad option ‘-fstrict-overflow’ to pragma ‘optimize’ [-Wpragmas]
   33 | #pragma GCC optimize("-fstrict-overflow")
      |                                         ^
answer.code:35:41: warning: bad option ‘-fcse-skip-blocks’ to pragma ‘optimize’ [-Wpragmas]
   35 | #pragma GCC optimize("-fcse-skip-blocks")
      |                                         ^
answer.code:49:51: warning: bad option ‘-funsafe-loop-optimizations’ to pragma ‘optimize’ [-Wpragmas]
   49 | #pragma GCC optimize("-funsafe-loop-optimizations")
      |                                                   ^
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
   53 | #pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
      |                                                                ^
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fstrict-overflow’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fcse-skip-blocks’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-funsafe-loop-optimizations’ to attribute ‘optimize’ [-Wattributes]
answer.code:53:64: warning: bad option ‘-fwhole-program’ to at...