結果

問題 No.3125 Make It Symmetry
ユーザー elphe
提出日時 2025-04-25 21:29:29
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 937 ms
コンパイル使用メモリ 86,160 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-25 21:29:35
合計ジャッジ時間 2,184 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <vector>

using namespace std;

static inline constexpr const char* solve(const uint32_t N, const vector<string>& A)
{
	uint32_t count = 0;
	for (uint32_t i = 0; i != N; ++i)
		for (uint32_t j = 0; j != N / 2; ++j)
			if (A[i][j] != A[i][(N - 1) - j])
				++count;

	if ((count & 1) && !(N & 1)) return "No";
	else return "Yes";
}

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	uint32_t N, i;
	cin >> N;
	vector<string> A(N);
	for (i = 0; i != N; ++i)
	{
		A[i].reserve(N);
		cin >> A[i];
	}

	cout << solve(N, A) << '\n';
	return 0;
}
0