結果
| 問題 |
No.641 Team Contest Estimation
|
| コンテスト | |
| ユーザー |
Pulmn
|
| 提出日時 | 2018-01-26 22:58:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,445 bytes |
| コンパイル時間 | 2,203 ms |
| コンパイル使用メモリ | 164,972 KB |
| 実行使用メモリ | 170,220 KB |
| 最終ジャッジ日時 | 2024-12-28 01:34:36 |
| 合計ジャッジ時間 | 15,632 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 5 TLE * 4 |
ソースコード
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-10;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
int n;
vs a;
int ff(){
int res,B=1;
for(int i=0;i<n-1;i++) if(a[i][0]=='#') B=0;
res=B;
for(int i=0;i<n-1;i++){
B=1;
for(int j=1;j<n;j++) if(a[i][j]=='#') B=0;
res+=B;
}
B=1;
for(int i=1;i<n-1;i++) if(a[n-1][i]=='#') B=0;
if(a[n-1][0]=='#'&&a[n-1][n-1]=='#') B=0;
res+=B;
vs b(n);
for(int i=0;i<n;i++) for(int j=0;j<n;j++) b[i]+=a[n-i-1][j];
a=b;
return res;
}
int f(){
int res=max(ff(),ff());
vs b(n);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++) b[i]+=a[j][n-i-1];
}
a=b;
return res;
}
int main(){
cin>>n;
a=vs(n);
for(int i=0;i<n;i++) cin>>a[i];
int res=max({f(),f(),f(),f()});
bool B=1;
for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(i==0||i==n-1||j==0||j==n-1){
if(a[i][j]=='#') B=0;
}
if(B) res=max(res,4);
cout<<res<<endl;
}
Pulmn