結果

問題 No.640 76本のトロンボーン
ユーザー e869120e869120
提出日時 2018-01-26 22:32:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,240 bytes
コンパイル時間 715 ms
コンパイル使用メモリ 83,520 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 19:22:36
合計ジャッジ時間 1,557 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <functional>
#include <cmath>
#include <tuple>
using namespace std;
#pragma warning (disable: 4996)

string S[76]; int n, maxn;

bool check(string V) {
	for (int i = 0; i < V.size(); i++) {
		if (V[i] == '#') return false;
	}
	return true;
}
int count() {
	int ret = 0;
	for (int i = 0; i < n; i++) {
		int F = 0;
		for (int j = 0; j < n; j++) {
			if (S[j][i] == '#') F = 0;
			else F++;
			if (F == n - 1) { ret++; F = 0; }
		}
	}
	return ret;
}

int main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> S[i];
	}
	for (int i = 0; i < 2; i++) {
		maxn = max(maxn, count());
		for (int j = 0; j < n; j++) {
			if (check(S[j].substr(0, n - 1)) == true) {
				for (int k = 0; k < n - 1; k++) S[j][k] = '#';
				maxn = max(maxn, count() + 1);
				for (int k = 0; k < n - 1; k++) S[j][k] = '.';
			}
			if (check(S[j].substr(1, n - 1)) == true) {
				for (int k = 1; k < n; k++) S[j][k] = '#';
				maxn = max(maxn, count() + 1);
				for (int k = 1; k < n; k++) S[j][k] = '.';
			}
		}

		for (int j = 0; j < n; j++) {
			for (int k = j + 1; k < n; k++) swap(S[j][k], S[k][j]);
		}
	}
	cout << maxn << endl;
	return 0;
}
0