結果

問題 No.3410 Happiest Art
コンテスト
ユーザー 👑 tails
提出日時 2025-12-17 02:24:49
言語 cLay
(20241019-1 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 606 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,471 ms
コンパイル使用メモリ 196,612 KB
実行使用メモリ 814,492 KB
最終ジャッジ日時 2025-12-17 02:25:11
合計ジャッジ時間 19,214 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 6 WA * 19 MLE * 1 -- * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:288:12: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
  288 |   for(auto&[b,v]:m){
      |            ^

ソースコード

diff #
raw source code

typedef bitset<10000> B;

ll@(n,u,h,w);
unordered_map<B,ll> m;
rep(i,n){
	ll inc=i<u?1:-1;
	ll@f;
	B b;
	rep(y,h){
		string@s;
		rep(x,w){
			if(s[x]=='#'){
				b.set(y*w+x);
			}
		}
	}
	m[b]+=inc;
	if(f){
		rep(y,h){
			rep(x,w){
				b.flip(y*w+x);
				m[b]+=inc;
				b.flip(y*w+x);
			}
		}
	}
}

ll best_v=-200;
B best_b;
for(auto&[b,v]:m){
	if(best_v<v){
		best_v=v;
		best_b=b;
	}
}

if(best_v<0 && m.size()<h*w){
	// find unused
	best_v=0;
	B b;
	ull t=0;
	while(m.count(b)){
		b.flip(__builtin_ctz(++t));
	}
	best_b=b;
}

wt(best_v);
rep(y,h){
	rep(x,w){
		wtN(best_b[y*h+x]?'#':'.');
	}
	wt("");
}
0