結果
| 問題 |
No.883 ぬりえ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-17 11:40:10 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,067 bytes |
| コンパイル時間 | 3,080 ms |
| コンパイル使用メモリ | 247,552 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-17 11:40:24 |
| 合計ジャッジ時間 | 12,641 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 10 WA * 1 RE * 8 |
ソースコード
#ifndef LOCAL
#include <bits/stdc++.h>
using namespace std;
#define debug(...) (void(0))
#else
#include "algo/debug.h"
#endif
void solve() {
int N, K;
cin >> N >> K;
auto check = [&](int L) -> bool {
int Lq = L / K, Lr = L % K;
return K * K * Lq + Lr * Lr <= N;
};
int lo = 1, hi = 1001;
while (hi - lo > 1) {
int mi = (lo + hi) >> 1;
(check(mi) ? lo : hi) = mi;
}
cout << lo << endl;
vector<string> ans(lo, string(lo, '.'));
int cur = 0;
[&]() -> void {
while (N) {
for (int i = cur; i < min(lo, cur + K); i++) {
for (int j = cur; j < min(lo, cur + K); j++) {
ans[i][j] = '#';
N--;
if (!N) return;
}
}
cur += K;
}
}();
for (int i = 0; i < lo; i++) cout << ans[i] << "\n";
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int tt = 1;
// std::cin >> tt;
while (tt--) {
solve();
}
}