結果
| 問題 |
No.2711 Connecting Lights
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-03-31 14:45:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 248 ms / 5,000 ms |
| コード長 | 1,525 bytes |
| コンパイル時間 | 1,709 ms |
| コンパイル使用メモリ | 192,044 KB |
| 最終ジャッジ日時 | 2025-02-20 17:24:08 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#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;
}