結果

問題 No.883 ぬりえ
ユーザー sahiyasahiya
提出日時 2020-12-06 04:25:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,687 bytes
コンパイル時間 1,558 ms
コンパイル使用メモリ 113,368 KB
実行使用メモリ 4,640 KB
最終ジャッジ日時 2023-10-17 04:07:16
合計ジャッジ時間 6,177 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 WA -
testcase_08 AC 2 ms
4,348 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 12 ms
4,548 KB
testcase_16 AC 5 ms
4,548 KB
testcase_17 WA -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef bitset<16> BS;

const ll MOD = 1E+09 + 7;
const ll INF = 1E18;
const int MAX_N = 1000;

int N, K;

char ans[MAX_N + 1][MAX_N + 1];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N >> K;

    int p = N / (K * K), r = N % (K * K);
    fill(ans[1], ans[N + 1], '.');
    for (int c = 0; c < p; c++) {
        for (int i = 1; i <= K; i++) {
            for (int j = 1; j <= K; j++) {
                ans[c * K + i][c * K + j] = '#';
            }
        }
    }
    int sr = 0;
    while (sr * sr <= r) {
        sr++;
    }
    sr--;
    for (int i = 1; i <= sr; i++) {
        for (int j = i; j <= sr; j++) {
            if (p * K + (i - 1) + sr + j <= N) {
                ans[(p - 1) * K + i][(p - 1) * K + j] = '#';
            }
        }
    }

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */

    int M = p * K + sr;
    cout << M << "\n";
    for (int i = 1; i <= M; i++) {
        for (int j = 1; j <= M; j++) {
            cout << ans[i][j];
        }
        cout << "\n";
    }

    return 0;
}
0