結果

問題 No.883 ぬりえ
ユーザー okok
提出日時 2019-09-13 21:38:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,233 bytes
コンパイル時間 1,452 ms
コンパイル使用メモリ 84,056 KB
実行使用メモリ 12,712 KB
最終ジャッジ日時 2023-09-17 07:01:49
合計ジャッジ時間 2,682 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
12,464 KB
testcase_01 AC 9 ms
12,436 KB
testcase_02 AC 9 ms
12,380 KB
testcase_03 AC 9 ms
12,608 KB
testcase_04 AC 9 ms
12,372 KB
testcase_05 AC 9 ms
12,528 KB
testcase_06 AC 9 ms
12,496 KB
testcase_07 WA -
testcase_08 AC 9 ms
12,432 KB
testcase_09 WA -
testcase_10 AC 9 ms
12,552 KB
testcase_11 AC 9 ms
12,424 KB
testcase_12 AC 9 ms
12,472 KB
testcase_13 AC 9 ms
12,496 KB
testcase_14 AC 9 ms
12,548 KB
testcase_15 AC 35 ms
12,428 KB
testcase_16 AC 16 ms
12,376 KB
testcase_17 AC 11 ms
12,592 KB
testcase_18 AC 9 ms
12,380 KB
testcase_19 AC 9 ms
12,372 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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";}



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

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

*/
0