結果

問題 No.641 Team Contest Estimation
ユーザー PulmnPulmn
提出日時 2018-01-26 22:58:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,445 bytes
コンパイル時間 2,621 ms
コンパイル使用メモリ 151,240 KB
実行使用メモリ 15,460 KB
最終ジャッジ日時 2023-08-27 19:34:35
合計ジャッジ時間 5,502 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0