結果
| 問題 | 
                            No.2256 Step by Step
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Nachia
                         | 
                    
| 提出日時 | 2023-03-23 05:44:50 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 1,988 bytes | 
| コンパイル時間 | 1,016 ms | 
| コンパイル使用メモリ | 81,264 KB | 
| 最終ジャッジ日時 | 2025-02-11 16:22:45 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 32 | 
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <atcoder/modint>
using namespace std;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
const i64 INF = 1001001001001001001;
using Modint = atcoder::static_modint<998244353>;
vector<string> ans3 = {
    "012",
    "345",
    "345",
    "225",
    "141",
    "300"
};
vector<string> ans1 = {
    "1",
    "1",
    "0",
    "0",
    "0",
    "1"
};
vector<string> ans4 = {
    "4551",
    "3662",
    "6777",
    "3005",
    "3442",
    "0112"
};
vector<string> start1 = {
    "0",
    "1",
    "2",
    "4",
    "4",
    "4"
};
vector<string> start3 = {
    "058",
    "137",
    "237",
    "444",
    "535",
    "887"
};
vector<string> start4 = {
    "0998",
    "1886",
    "2445",
    "8884",
    "9775",
    "7665"
};
vector<string> stop4 = {
    "7801",
    "6719",
    "6549",
    "4480",
    "8579",
    "6522"
};
vector<string> stop2 = {
    "12",
    "43",
    "43",
    "00",
    "41",
    "23"
};
vector<string> mid4 = {
    "0562",
    "1713",
    "2743",
    "4400",
    "5751",
    "6623"
};
int main(){
    int N; cin >> N;
    if(N == 1){
        rep(t,6) cout << ans1[t] << '\n';
    }
    else if(N == 2){
        cout << "-1\n";
    }
    else if(N == 3){
        rep(t,6) cout << ans3[t] << '\n';
    }
    else if(N == 4){
        rep(t,6) cout << ans4[t] << '\n';
    }
    else{
        vector<string> ans(6);
        auto addExp = [&](vector<string> src){
            rep(t,6){
                ans[t] += src[t];
            }
        };
        addExp((N-5)&2 ? stop4 : stop2);
        for(int t=8; t<N; t+=4) addExp(mid4);
        addExp((N-5)&1 ? start4 : start3);
        rep(t,6) cout << ans[t] << '\n';
    }
    return 0;
}
struct ios_do_not_sync{
    ios_do_not_sync(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;
            
            
            
        
            
Nachia