結果
| 問題 |
No.640 76本のトロンボーン
|
| コンテスト | |
| ユーザー |
rgnerdplayer
|
| 提出日時 | 2025-05-01 14:26:29 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,920 bytes |
| コンパイル時間 | 3,593 ms |
| コンパイル使用メモリ | 279,568 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-01 14:26:33 |
| 合計ジャッジ時間 | 4,763 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 6 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
auto solve = [&]() {
int n;
cin >> n;
vector<string> s(n);
for (int i = 0; i < n; i++) {
cin >> s[i];
}
auto transpose = [&]() {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
swap(s[i][j], s[j][i]);
}
}
};
if ([&]() {
for (int i = 0; i < n; i++) {
if (s[i][0] == '#' || s[i][n - 1] == '#' || s[0][i] == '#' || s[n - 1][i] == '#') {
return false;
}
}
return true;
}()) {
cout << 4 << '\n';
return;
}
auto work = [&]() {
int res = 0;
for (int j = 0; j < n; j++) {
int x = 0;
for (int i = 0; i < n; i++) {
if (s[i][j] == '.') {
x++;
} else {
x = 0;
}
if (x == n - 1) {
res++;
break;
}
}
}
return res;
};
int ans = work();
for (int rep = 0; rep < 2; rep++) {
for (int i = 0; i < n; i++) {
for (int j : {0, 1}) {
if (s[i].substr(j, n - 1) == string(n - 1, '.')) {
fill(s[i].begin() + j, s[i].begin() + j + n - 1, '#');
ans = max(ans, work() + 1);
fill(s[i].begin() + j, s[i].begin() + j + n - 1, '.');
}
}
}
}
cout << ans << '\n';
};
solve();
return 0;
}
rgnerdplayer