結果

問題 No.883 ぬりえ
ユーザー okok
提出日時 2019-09-13 22:05:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,168 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 84,232 KB
実行使用メモリ 12,644 KB
最終ジャッジ日時 2023-09-17 14:23:47
合計ジャッジ時間 2,578 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
12,392 KB
testcase_01 AC 9 ms
12,432 KB
testcase_02 AC 9 ms
12,528 KB
testcase_03 AC 9 ms
12,568 KB
testcase_04 AC 9 ms
12,644 KB
testcase_05 AC 9 ms
12,428 KB
testcase_06 AC 9 ms
12,480 KB
testcase_07 WA -
testcase_08 AC 9 ms
12,532 KB
testcase_09 WA -
testcase_10 AC 9 ms
12,328 KB
testcase_11 AC 9 ms
12,328 KB
testcase_12 AC 9 ms
12,460 KB
testcase_13 AC 9 ms
12,640 KB
testcase_14 AC 9 ms
12,488 KB
testcase_15 AC 34 ms
12,528 KB
testcase_16 AC 15 ms
12,600 KB
testcase_17 AC 12 ms
12,388 KB
testcase_18 AC 9 ms
12,328 KB
testcase_19 AC 8 ms
12,616 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 j = i; j >= 0; j--){
			int y = j;
			int x = i;
			if(conh[y] < K && conw[x] < K && con < N && !ans[y][x]){
				conh[y]++;
				conw[x]++;
				ans[y][x] = true;
				con++;
			}
			swap(y,x);
			if(conh[y] < K && conw[x] < K && con < N && !ans[y][x]){
				conh[y]++;
				conw[x]++;
				ans[y][x] = true;
				con++;
			}
		}
		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