結果
問題 | No.2669 Generalized Hitting Set |
ユーザー | suisen |
提出日時 | 2023-09-21 02:13:17 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,176 bytes |
コンパイル時間 | 949 ms |
コンパイル使用メモリ | 76,344 KB |
実行使用メモリ | 134,392 KB |
最終ジャッジ日時 | 2024-01-16 20:53:07 |
合計ジャッジ時間 | 11,134 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
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 | 21 ms
6,676 KB |
testcase_04 | AC | 20 ms
6,676 KB |
testcase_05 | AC | 19 ms
6,676 KB |
testcase_06 | AC | 41 ms
6,676 KB |
testcase_07 | AC | 9 ms
6,676 KB |
testcase_08 | AC | 20 ms
6,676 KB |
testcase_09 | AC | 96 ms
6,676 KB |
testcase_10 | AC | 90 ms
6,676 KB |
testcase_11 | AC | 75 ms
6,676 KB |
testcase_12 | AC | 774 ms
6,676 KB |
testcase_13 | AC | 1,611 ms
134,392 KB |
testcase_14 | AC | 25 ms
19,700 KB |
testcase_15 | AC | 3 ms
6,676 KB |
testcase_16 | AC | 41 ms
7,416 KB |
testcase_17 | AC | 156 ms
19,704 KB |
testcase_18 | AC | 2 ms
6,676 KB |
testcase_19 | AC | 12 ms
6,676 KB |
testcase_20 | AC | 2 ms
6,676 KB |
testcase_21 | AC | 29 ms
7,412 KB |
testcase_22 | AC | 11 ms
6,676 KB |
testcase_23 | TLE | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
ソースコード
// TLE: O(2^n m) #include <iostream> #include <vector> std::vector<size_t> calc_f(const size_t n, const size_t m, const size_t k, const std::vector<uint> &s) { std::vector<size_t> f(1 << n); for (uint t = 0; t < 1u << n; ++t) for (size_t i = 0; i < m; ++i) { f[t] += __builtin_popcount(t & s[i]) >= k; } return f; } std::vector<size_t> calc_g(const size_t n, const size_t m, const std::vector<size_t> &f) { std::vector<size_t> g(m + 1, n + 1); for (uint t = 0; t < 1u << n; ++t) { g[f[t]] = std::min<size_t>(g[f[t]], __builtin_popcount(t)); } for (size_t p = m; p; --p) { g[p - 1] = std::min(g[p - 1], g[p]); } return g; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); size_t n, m, k; std::cin >> n >> m >> k; std::vector<uint> s(m); for (size_t i = 0; i < m; ++i) { std::string si; std::cin >> si; for (size_t j = 0; j < n; ++j) { s[i] |= (si[j] - '0') << j; } } auto f = calc_f(n, m, k, s); auto g = calc_g(n, m, f); for (size_t p = 1; p <= m; ++p) { std::cout << g[p] << '\n'; } }