結果

問題 No.640 76本のトロンボーン
ユーザー pazzle1230pazzle1230
提出日時 2018-01-26 22:59:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,579 bytes
コンパイル時間 1,058 ms
コンパイル使用メモリ 101,504 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 19:34:45
合計ジャッジ時間 1,924 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <cctype>
#include <complex>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

int N;
vector<string> f;

int fil(){
	vector<string> fc = f;
	int cnt = 0;
	N = fc.size();
	REP(i, N){
		if(fc[i].substr(0, N-1) == string(N-1, '.')){
			cnt++;
			REP(j, N-1)
				fc[i][j] = '#';
		}else if(fc[i].substr(1, N-1) == string(N-1, '.')){
			cnt++;
			REP(j, N-1)
				fc[i][j+1] = '#';
		}
	}
	REP(i, N){
		int c = 0;
		REP(j, N){
			if(fc[j][i] == '.')
				c++;
			else
				c = 0;
			if(c == N-1){
				cnt++;
			}
		}
	}
	return cnt;
}

int main(void){
	int N;
	cin >> N;
	f.resize(N);
	REP(i, N){
		cin >> f[i];
	}
	int res = 0;
	res = max(res, fil());
	REP(i, N){
		reverse(all(f[i]));
	}
	res = max(res, fil());
	vector<string> f2(N, string(N, '.'));
	REP(i, N){
		REP(j, N){
			f2[i][j] = f[j][i];
		}
	}
	f = f2;
	res = max(res, fil());
	REP(i, N){
		reverse(all(f[i]));
	}
	res = max(res, fil());
	cout << res << endl;
}
0