結果
問題 | No.2388 At Least K-Characters |
ユーザー | as277575 |
提出日時 | 2023-07-21 23:11:52 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,385 bytes |
コンパイル時間 | 1,275 ms |
コンパイル使用メモリ | 127,132 KB |
実行使用メモリ | 124,880 KB |
最終ジャッジ日時 | 2024-07-05 04:02:23 |
合計ジャッジ時間 | 7,377 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | WA | - |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,940 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 2 ms
6,940 KB |
testcase_08 | AC | 2 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | AC | 2 ms
6,940 KB |
testcase_11 | WA | - |
testcase_12 | AC | 2 ms
6,944 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
ソースコード
#include <algorithm> #include <bit> #include <bitset> #include <cassert> #include <cstdio> #include <cstdlib> #include <cmath> #include <deque> #include <iostream> #include <map> #include <random> #include <unordered_set> #include <unordered_map> #include <vector> #include <set> #include <string> using namespace::std; template<typename T, typename U> ostream& operator<< (ostream& o, const pair<T, U>& p) { o << "<" << p.first << ", " << p.second << ">"; return o; } template <typename T> ostream& operator<< (ostream& o, const vector<T>& v) { for (const auto& x : v) o << x << " "; return o; } template <typename T> ostream& operator<< (ostream& o, const set<T>& v) { for (const auto& x : v) o << x << " "; return o; } template <typename T> ostream& operator<< (ostream& o, const deque<T>& v) { for (const auto& x : v) o << x << " "; return o; } template <typename K, typename V> ostream& operator<<(ostream& o, const unordered_map<K, V>& m) { o << "{"; for (const auto& [k, v] : m) o << " " << k << ": " << v << ","; o << "}"; return o; } template <typename T> istream& operator>> (istream& i, vector<T>& v) { for (auto& x : v) i >> x; return i; } istream& operator>> (istream& i, pair<int, int>& p) { i >> p.first >> p.second; return i; } int main() { ios::sync_with_stdio(false); long long n, m, k; string s; cin >> n >> m >> k >> s; const long long p = 998244353; long long r = 0; bitset<32> present; vector<vector<long long>> lowered(m + 1, vector<long long>('z' - 'a' + 1)); for (int l = 1; l <= m; ++l) { if (l <= n) { char c = s[l - 1]; int i = c - 'a'; bitset<32> lower = (1 << i) - 1; lowered[l][present.count()] += (lower & present).count(); lowered[l][present.count()] %= p; lowered[l][present.count() + 1] += (lower & ~present).count(); lowered[l][present.count() + 1] %= p; present.set(i); } for (int j = 0; j <= ('z' - 'a' + 1); ++j) { lowered[l][j] += (lowered[l - 1][j] * j) % p; lowered[l][j] %= p; if (j > 0) { lowered[l][j] += (lowered[l - 1][j - 1] * ('z' - 'a' + 1 - (j - 1))) % p; lowered[l][j] %= p; } } for (int j = k; j <= ('z' - 'a' + 1); ++j) r = (r + lowered[l][j]) % p; } //cerr << lowered << endl; cout << r << endl; return 0; }