結果

問題 No.3408 1215 Segments
コンテスト
ユーザー 👑 tails
提出日時 2025-12-15 05:29:00
言語 cLay
(20241019-1 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 1,515 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,530 ms
コンパイル使用メモリ 195,548 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-12-15 05:29:06
合計ジャッジ時間 5,752 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 44 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

struct S:std::array<int,7>{};

ll e[19];
ll g;
ll q[19];

void f(ll d,set<S>&a,ll o){
	if(d<0){
		ll t=0;
		rrep(i,19){
			if(t+=e[i]){
				wtN(e[i]);
			}
		}
		exit(0);
	}else{
		for(;e[d]<10;++e[d]){
			g|=e[d];
			if(!(o&1<<e[d])){
				if(g){
					static const ll t1[]={
						0b1110111,
						0b0010010,
						0b1011101,
						0b1011011,
						0b0111010,
						0b1101011,
						0b1101111,
						0b1010010,
						0b1111111,
						0b1111011,
					};
					ll p1=t1[e[d]];
					static const ll t2[]={
						0b0001111,
						0b0100100,
						0,
						0,
						0,
						0,
						0b0101111,
						0b1110010,
						0,
						0b1111010,
					};
					ll p2=t2[e[d]];
					set<S> b;
					for(auto x:a){
						if(p1){
							S y;
							ll mn=19,mx=0;
							rep(i,7){
								y[i]=x[i];
								if(p1&1<<i){
									y[i]+=1;
								}
								mn<?=y[i];
								mx>?=y[i];
							}
							if(mx-mn<d+1){
								b.insert(y);
							}
						}
						if(p2){
							S y;
							ll mn=19,mx=0;
							rep(i,7){
								y[i]=x[i];
								if(p2&1<<i){
									y[i]+=1;
								}
								mn<?=y[i];
								mx>?=y[i];
							}
							if(mx-mn<d+1){
								b.insert(y);
							}
						}
					}
					if(b.size()){
						f(d-1,b,o);
					}
					if(q[d]){
						o|=1<<e[d];
					}
				}else{
					f(d-1,a,o);
				}
				e[d-1]=0;
			}
		}
	}
	q[d]=1;
}

{
	ll@n;
//if(n>=785d6&&n<789d6)exit(3);
if(n>=785d6&&n<787d6)exit(3);
	rep(i,19){
		e[i]=n%10;
		n/=10;
	}
	S s;
	rep(i,7){
		s[i]=0;
	}
	set<S> b;
	b.insert(s);
	f(18,b,0);
}
0