結果
| 問題 |
No.640 76本のトロンボーン
|
| コンテスト | |
| ユーザー |
kotamanegi
|
| 提出日時 | 2018-01-26 23:01:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,319 bytes |
| コンパイル時間 | 1,451 ms |
| コンパイル使用メモリ | 124,536 KB |
| 最終ジャッジ日時 | 2025-01-05 07:58:03 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 WA * 2 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <cstdlib>
using namespace std;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 3000000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
#define seg_size 524288
int grid[100][100] = {};
int n;
int tate_can_do(int x, int y) {
if (x >= 2) return 0;
for (int q = 0;q < n - 1;++q) {
if (grid[x + q][y] == 1) return 0;
}
return 1;
}
int yoko_can_do(int x, int y) {
if (y >= 2) return 0;
for (int q = 0;q < n - 1;++q) {
if (grid[x][y+q] == 1) return 0;
}
return 1;
}
int main() {
cin >> n;
REP(i, n) {
string s;
cin >> s;
for (int q = 0;q < s.length();++q) {
if (s[q] == '#') grid[i][q] = 1;
}
}
long long ans = 0;
for (int turn = 0;turn < 10;++turn) {
if (tate_can_do(0, 0) == 1) {
if (yoko_can_do(n - 1, 0) == 1) {
long long tate = 0;
for (int q = 1;q < n-1;++q) {
tate += tate_can_do(0, q);
}
tate += max(tate_can_do(0, n - 1), tate_can_do(1, n - 1));
long long yoko = 0;
for (int q = 0;q < n - 1;++q) {
yoko += yoko_can_do(q, 1);
}
ans = max({ ans,yoko+2,tate+2 });
}
if (yoko_can_do(n - 1, 1) == 1) {
long long tate = 0;
for (int q = 1;q < n;++q) {
tate += tate_can_do(0, q);
}
long long yoko = 0;
for (int q = 0;q < n - 1;++q) {
yoko += yoko_can_do(q, 1);
}
ans = max({ ans,yoko+2,tate+2 });
}
long long tate = 0;
for (int q = 1;q < n;++q) {
tate += max(tate_can_do(0, q),tate_can_do(1,q));
}
long long yoko = 0;
for (int q = 0;q < n - 1;++q) {
yoko += yoko_can_do(q, 1);
}
ans = max({ ans,yoko+1,tate+1});
}
if (tate_can_do(1, 0) == 1) {
if (yoko_can_do(n-1,1) == 1) {
long long tate = 0;
long long yoko = 0;
for (int q = 1;q < n;++q) {
tate += tate_can_do(0, q);
}
for (int q = 1;q < n - 1;++q) {
yoko += yoko_can_do(q, 1);
}
yoko += max(yoko_can_do(0, 0), yoko_can_do(0, 1));
ans = max({ ans,yoko + 2,tate + 2});
}
long long tate = 0;
long long yoko = 0;
for (int q = 1;q < n;++q) {
tate += max(tate_can_do(0, q), tate_can_do(1, q));
}
for (int q = 1;q < n;++q) {
yoko += yoko_can_do(q, 1);
}
yoko += max(yoko_can_do(0, 0), yoko_can_do(0, 1));
ans = max({ ans,yoko + 1,tate + 1 });
}
long long tate = 0, yoko = 0;
for (int q = 0;q < n;++q) {
tate += max(tate_can_do(0, q),tate_can_do(1,q));
}
for (int q = 0;q < n;++q) {
yoko += max(yoko_can_do(q,0),yoko_can_do(q, 1));
}
ans = max({ ans,yoko,tate });
int copy_grid[100][100] = {};
for (int t = 0;t < n;++t) {
for (int q = 0;q < n;++q) {
copy_grid[q][n-t-1] = grid[t][q];
}
}
for (int t = 0;t < n;++t) {
for (int q = 0;q < n;++q) {
grid[t][q] = copy_grid[t][q];
}
}
}
cout << ans << endl;
return 0;
}
kotamanegi