結果
| 問題 |
No.640 76本のトロンボーン
|
| ユーザー |
TangentDay
|
| 提出日時 | 2018-01-26 23:20:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,582 bytes |
| コンパイル時間 | 866 ms |
| コンパイル使用メモリ | 87,052 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-28 02:11:36 |
| 合計ジャッジ時間 | 1,844 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 WA * 3 |
ソースコード
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
using namespace std;
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
int calc2(vector<string> s){
int n = s.size();
REP(i,n-1) if (s[i][n-1] == '#') return 0;
int ret = 1;
REP(i,n){
int ok = 1;
REP(j,n-1) if (s[i][j] == '#') ok = 0;
ret += ok;
}
return ret;
}
int calc(vector<string> s){
int n = s.size();
int ret = 0;
REP(i,n){
bool ok = true;
FOR(j,1,n-2) if (s[i][j] == '#') ok = false;
if (!ok) continue;
if (s[i][0] == '.' || s[i][n-1] == '.') ret++;
}
ret = max(ret, calc2(s));
reverse(ALL(s));
ret = max(ret, calc2(s));
reverse(ALL(s));
REP(i,n) reverse(ALL(s[i]));
ret = max(ret, calc2(s));
reverse(ALL(s));
ret = max(ret, calc2(s));
return ret;
}
int main() {
int n;
cin >> n;
vector<string> s(n);
REP(i,n) cin >> s[i];
vector<string> t(n, string(n, '.'));
REP(i,n){
REP(j,n) t[i][j] = s[j][i];
}
cout << max(calc(s), calc(t)) << endl;
return 0;
}
TangentDay