結果

問題 No.883 ぬりえ
ユーザー okok
提出日時 2019-09-13 22:31:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 1,407 bytes
コンパイル時間 776 ms
コンパイル使用メモリ 84,380 KB
実行使用メモリ 12,684 KB
最終ジャッジ日時 2023-09-17 15:30:28
合計ジャッジ時間 2,136 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
12,616 KB
testcase_01 AC 9 ms
12,380 KB
testcase_02 AC 9 ms
12,424 KB
testcase_03 AC 9 ms
12,684 KB
testcase_04 AC 9 ms
12,428 KB
testcase_05 AC 9 ms
12,536 KB
testcase_06 AC 8 ms
12,556 KB
testcase_07 AC 9 ms
12,516 KB
testcase_08 AC 9 ms
12,616 KB
testcase_09 AC 9 ms
12,384 KB
testcase_10 AC 9 ms
12,636 KB
testcase_11 AC 9 ms
12,492 KB
testcase_12 AC 8 ms
12,500 KB
testcase_13 AC 9 ms
12,492 KB
testcase_14 AC 8 ms
12,512 KB
testcase_15 AC 33 ms
12,564 KB
testcase_16 AC 15 ms
12,376 KB
testcase_17 AC 11 ms
12,564 KB
testcase_18 AC 9 ms
12,536 KB
testcase_19 AC 9 ms
12,440 KB
testcase_20 AC 9 ms
12,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include<cassert>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}


int N, K;

bool check(int num){
	
	// cout<<num <<" "<<min(K,num)*num <<endl;
	
	if(min(K,num)*num < N) return false;
	
	return true;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	const int MAX = 1100;
	int con = 0, M = 0;
	vector<vector<int>> ans(MAX, vector<int>(MAX, false));
	vector<int> conh(MAX), conw(MAX);
	
	cin>>N>>K;
	
	for(int i = 1; ; i++){
		if(check(i)){
			M = i;
			break;
		}
	}
	for(int i = 0; i < M; i++){
		
		for(int j = 0; j < K && j < M; j++){
			if(con++ < N){
				ans[i][(i+j)%M] = true;
			}
		}
	}
	
	cout<<M<<endl;
	
	for(int i = 0; i < M; i++){
		for(int j = 0; j < M; j++){
			cout<<(ans[i][j]?"#":".");
		}
		cout<<endl;
	}
	
	return 0;
}
/*
##...
##...
..##.
..##.
....#

#.....
.#....
..#...
...#..
....#.
.....#

##....
.##...
..##..
...##.
....##

##....
.##...
..##..
...##.
....##
#....#

###....
.###...
..###..
...###.
....###
#....##
##....#

######..
.######.
..######

###
###
###


###....
###....
###....
...###.
...###.
...###.
......#


###...
###...
###...

*/
0