結果

問題 No.2256 Step by Step
ユーザー farfarqwq
提出日時 2025-05-24 16:08:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,759 bytes
コンパイル時間 2,046 ms
コンパイル使用メモリ 195,936 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-24 16:08:58
合計ジャッジ時間 3,799 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1005;
string beg[4][6] = 
{
    {
        "80044 ", 
        "68802 ", 
        "57731 ", 
        "544714", 
        "433000", 
        "566212"
    }, 
    {
        "45 ", 
        "31 ", 
        "31 ", 
        "000", 
        "515", 
        "344"
    },
    {
        "566", 
        "355", 
        "144", 
        "0336", 
        "0224", 
        "0112"
    }, 
    {
        "1388 ", 
        "3276 ", 
        "7245 ", 
        "01158", 
        "02344", 
        "07656"
    }
};
string mid[6] = 
{
    "1388 ", 
    "3276 ", 
    "7245 ", 
    " 1158", 
    " 2344", 
    " 7656"
};
string ed[6] = 
{
    "937", 
    "315", 
    "715", 
    " 99", 
    " 13", 
    " 75"
};
char res[6][N];
int now = 0;
inline void prt(string *a, int len) {
    for (int i = 0; i < 6; i++)
        for (int j = 0; j <= len; j++)
            if (isdigit(a[i][j]))
                res[i][now + j] = a[i][j];
    now += len;
}
int main() {
    cin.tie(0)->sync_with_stdio(0);
    // freopen("game.in", "r", stdin);
    // freopen("game.out", "w", stdout);
    int n;
    cin >> n;
    if (n == 1) {
        cout << "1\n0\n0\n0\n1\n1\n";
        return 0;
    }
    if (n == 2) {
        cout << "-1\n";
        return 0;
    }
    if (n == 4) {
        cout << "1776\n7664\n0223\n0112\n0553\n5443\n";
        return 0;
    }
    if (n == 3) {
        res[3][0] = res[4][0] = res[5][0] = '2';
        prt(ed, 2);
    } else {
        prt(beg[n % 4], (n - 1) % 4 + 2);
        for (int i = 1; i < (n - 1) / 4; i++)
            prt(mid, 4);
        prt(ed, 2);
    }
    for (int j = 0; j < 6; j++, cout << '\n')
    for (int i = 0; i <= now; i++)
    cout << res[j][i];
    return 0;
}
0