結果

問題 No.883 ぬりえ
ユーザー MayimgMayimg
提出日時 2019-09-13 23:16:14
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 861 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 202,632 KB
実行使用メモリ 33,864 KB
最終ジャッジ日時 2023-09-17 15:19:30
合計ジャッジ時間 5,159 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
33,700 KB
testcase_01 AC 49 ms
33,720 KB
testcase_02 AC 49 ms
33,860 KB
testcase_03 AC 49 ms
33,556 KB
testcase_04 AC 48 ms
33,860 KB
testcase_05 WA -
testcase_06 AC 49 ms
33,652 KB
testcase_07 WA -
testcase_08 AC 50 ms
33,556 KB
testcase_09 WA -
testcase_10 AC 49 ms
33,652 KB
testcase_11 AC 50 ms
33,584 KB
testcase_12 AC 49 ms
33,648 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 58 ms
33,864 KB
testcase_16 AC 51 ms
33,612 KB
testcase_17 AC 50 ms
33,592 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
vector<vector<char>> ans(5555, vector<char>(5555, '.'));
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n, k;
  cin >> n >> k;
  int cur = 0;
  int row = 0, col = 0;
  while (cur < n) {
    int c = 1;
    while (c <= k && cur + c * c <= n) c++;
    c--;
    for (int i = 0; i < c; i++) {
      for (int j = 0; j < c; j++) {
        if (cur++ < n) ans[row + i][col + j] = '#';
      }
    }
    row += c;
    col += c;
  }
  int x = 0, y = 0;
  for (int i = 0; i < 5555; i++) for (int j = 0; j < 5555; j++) {
    if (ans[i][j] == '#') {
      x = max(x, i);
      y = max(y, j);
    }
  }
  cout << max(x, y) + 1 << '\n';
  for (int i = 0; i <= max(x, y); i++) {
    for (int j = 0; j <= max(x, y); j++) {
      cout << ans[i][j];
    }
    cout << '\n';
  }
  return 0;
}
0