結果

問題 No.3731 Kaleidoscope
コンテスト
ユーザー shobonvip
提出日時 2026-09-19 15:57:29
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 8 ms / 2,000 ms
+ 559µs
コード長 2,710 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,449 ms
コンパイル使用メモリ 380,888 KB
実行使用メモリ 10,036 KB
最終ジャッジ日時 2026-09-19 15:57:37
合計ジャッジ時間 6,704 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

/**
	author:  shobonvip
	created: 2026.09.19 15:04:42
**/

#include<bits/stdc++.h>
using namespace std;

//* ATCODER
#include<atcoder/all>
using namespace atcoder;
typedef modint998244353 mint;
//*/

/* BOOST MULTIPRECISION
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
//*/

typedef long long ll;

#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)
#define all(v) v.begin(), v.end()

template <typename T> bool chmin(T &a, const T &b) {
	if (a <= b) return false;
	a = b;
	return true;
}

template <typename T> bool chmax(T &a, const T &b) {
	if (a >= b) return false;
	a = b;
	return true;
}

template <typename T> T max(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]);
	return ret;
}

template <typename T> T min(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]);
	return ret;
}

template <typename T> T sum(vector<T> &a){
	T ret = 0;
	for (int i=0; i<(int)a.size(); i++) ret += a[i];
	return ret;
}


vector<vector<char>> solve(int n, string s) {

	vector<vector<char>> ans(n, vector<char>(n,'#'));

	rep(i,0,n) ans[i][0] = '.';
	rep(i,0,n) ans[n-1][i] = '.';
	rep(i,0,n) ans[1][i] = '.';
	rep(i,1,n) ans[i][n-1] = '.';

	if (1 < (int)s.size()+1) {
		if (s[0]=='o') ans[n-1][0] = '.';
		else ans[n-1][0] = '#';
	}
	if (2 < (int)s.size()+1) {
		if (s[1]=='o') ans[1][n-1] = '.';
		else ans[1][n-1] = '#';
	}

	rep(i,0,n/4) {
		int g = n-4-3*i;
		int x = g;
		int y = 1;
		rep(z,0,4*(i+1)) {
			ans[x][y] = '.';
			if (z%2==0) y++;
			else x++;
		}
		while (x<n-1) {
			ans[x][y] = '.';
			x++;
		}
		if (4*i+3 < (int)s.size()+1) {
			if (s[4*i+2]=='o') ans[n-3-3*i][1] = '.';
			else ans[n-3-3*i][1] = '#';
		}
		if (4*i+5 < (int)s.size()+1) {
			if (s[4*i+4]=='o') ans[n-4-3*i][1] = '.';
			else ans[n-4-3*i][1] = '#';
		}
		
	}

	rep(i,0,n/4) {
		int g = n-4-3*i;
		int x = 2;
		int y = g;
		rep(z,0,4*(i+1)) {
			ans[x][y] = '.';
			if (z%2==0) x++;
			else y++;
		}
		while (y<n-1) {
			ans[x][y] = '.';
			y++;
		}
		if (4*i+4 < (int)s.size()+1) {
			if (s[4*i+3]=='o') ans[2][n-3-3*i] = '.';
			else ans[2][n-3-3*i] = '#';
		}
		if (4*i+6 < (int)s.size()+1) {
			if (s[4*i+5]=='o') ans[2][n-4-3*i] = '.';
			else ans[2][n-4-3*i] = '#';
		}
	}


	return ans;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	string s; cin >> s;
	int n = (int)s.size();
//	int n; cin >> n;
	vector<vector<char>> ans = solve(n+16,s);
	cout << (int)ans.size() << '\n';
	rep(i,0,(int)ans.size()){
		rep(j,0,(int)ans[0].size()){
			cout << ans[i][j];
		}
		cout << '\n';
	}
}

0