結果

問題 No.2711 Connecting Lights
ユーザー wanuiwanui
提出日時 2024-03-31 14:45:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 249 ms / 5,000 ms
コード長 1,525 bytes
コンパイル時間 2,242 ms
コンパイル使用メモリ 202,032 KB
実行使用メモリ 10,072 KB
最終ジャッジ日時 2024-03-31 14:45:10
合計ジャッジ時間 3,993 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 6 ms
9,256 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 3 ms
6,676 KB
testcase_08 AC 4 ms
6,676 KB
testcase_09 AC 144 ms
9,196 KB
testcase_10 AC 7 ms
6,960 KB
testcase_11 AC 38 ms
9,580 KB
testcase_12 AC 30 ms
9,500 KB
testcase_13 AC 19 ms
9,748 KB
testcase_14 AC 4 ms
6,744 KB
testcase_15 AC 28 ms
6,980 KB
testcase_16 AC 6 ms
9,292 KB
testcase_17 AC 6 ms
9,520 KB
testcase_18 AC 6 ms
7,000 KB
testcase_19 AC 8 ms
9,316 KB
testcase_20 AC 40 ms
10,016 KB
testcase_21 AC 5 ms
9,368 KB
testcase_22 AC 3 ms
6,676 KB
testcase_23 AC 5 ms
9,848 KB
testcase_24 AC 72 ms
6,812 KB
testcase_25 AC 112 ms
6,932 KB
testcase_26 AC 244 ms
10,072 KB
testcase_27 AC 113 ms
10,072 KB
testcase_28 AC 249 ms
10,072 KB
testcase_29 AC 12 ms
10,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair<ll,ll>; const ll INF=4e18;
void print0(){}; template<typename H,typename... T> void print0(H h,T... t){cout<<h;print0(t...);}
void print1(){print0("\n");}; template<typename H,typename... T>void print1(H h,T... t){print0(h);if(sizeof...(T)>0)print0(" ");print1(t...);}
void ioinit() { cout<<fixed<<setprecision(15); cerr<<fixed<<setprecision(6); ios_base::sync_with_stdio(0); cin.tie(0); }
#define debug1(a) { cerr<<#a<<":"<<a<<endl; }
#define debug2(a,b) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<endl; }
#define debug3(a,b,c) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<" "<<#c<<":"<<c<<endl; }
#define debug4(a,b,c,d) { cerr<<#a<<":"<<a<<" "<<#b<<":"<<b<<" "<<#c<<":"<<c<<" "<<#d<<":"<<d<<endl; }
// clang-format on

const ll MODULO = 998244353;

ll N, M, K;
ll dp(ll col, ll s) {
    static bool done[20005][32];
    static ll memo[20005][32];
    if (done[col][s]) return memo[col][s];
    done[col][s] = true;

    if (col == M) {
        return memo[col][s] = 1;
    }
    ll ans = 0;
    for (ll t = 0; t < (1 << N); t++) {
        ll sum = 0;
        for (ll j = 0; j < N; j++) {
            if (((s >> j) & 1) && ((t >> j) & 1)) {
                sum++;
            }
        }
        if (col == 0 || sum >= K) {
            ans += dp(col + 1, t);
        }
    }
    return memo[col][s] = ans % MODULO;
}
int main() {
    ioinit();
    cin >> N >> M >> K;
    print1(dp(0, 0));
    return 0;
}
0