結果
| 問題 | No.3410 Happiest Art |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-17 01:26:07 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,939 bytes |
| 記録 | |
| コンパイル時間 | 3,185 ms |
| コンパイル使用メモリ | 286,764 KB |
| 実行使用メモリ | 814,540 KB |
| 最終ジャッジ日時 | 2025-12-17 01:26:45 |
| 合計ジャッジ時間 | 12,202 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 3 WA * 1 RE * 16 TLE * 4 MLE * 2 -- * 18 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using T = bitset<10000>;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string str;
int N, U, H, W, v;
cin >> N >> U >> H >> W;
vector<pair<T,bool>> tb;
for(int i = 0; i < N; i++){
cin >> v;
T S;
for(int y = 0; y < H; y++){
cin >> str;
for(int x = 0; x < W; x++){
if(str[x] == '#') S[y * W + x] = 1;
}
}
if(i < U){
tb.emplace_back(S, true);
if(v == 1){
for(int y = 0; y < H; y++){
for(int x = 0; x < W; x++){
S.flip(y * W + x);
tb.emplace_back(S, true);
S.flip(y * W + x);
}
}
}
}else{
tb.emplace_back(S, false);
if(v == 1){
for(int y = 0; y < H; y++){
for(int x = 0; x < W; x++){
S.flip(y * W + x);
tb.emplace_back(S, false);
S.flip(y * W + x);
}
}
}
}
}
sort(tb.begin(), tb.end(), [&](pair<T, bool> lhs, pair<T, bool> rhs){
for(int i = 0; i < H * W; i++){
if(lhs.first[i] < rhs.first[i]) return true;
}
return false;
});
int ans = -1;
T S = 0;
for(int i = 0; i < tb.size(); ){
int p = i, cnt = 0;
while(i < tb.size() && tb[i].first == tb[p].first){
cnt += tb[i].second ? 1 : -1;
i++;
}
if(cnt > ans){
ans = cnt;
S = tb[p].first;
}
}
cout << ans << '\n';
for(int y = 0; y < H; y++){
for(int x = 0; x < W; x++){
cout << (S[y * W + x] ? '#' : '.');
}
cout << '\n';
}
}