結果
問題 |
No.1313 N言っちゃダメゲーム (4)
|
ユーザー |
![]() |
提出日時 | 2020-05-28 01:56:18 |
言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 721 bytes |
コンパイル時間 | 644 ms |
コンパイル使用メモリ | 121,984 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-11-30 18:09:01 |
合計ジャッジ時間 | 39,238 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 TLE * 12 |
ソースコード
#include <iostream> #include <vector> #include <cassert> int main() { int n, k; std::string s; std::cin >> n >> k >> s; assert(1 <= k && k < n && n <= 200000); assert((int) s.size() == n - 1); for (char c : s) { assert(c == 'o' || c == 'x'); } std::vector<bool> dp(n + k + 1); // declarer for (int i = n - 1; i >= 0; i--) { if (i > 0 && s.at(i - 1) == 'x') continue; dp.at(i) = true; for (int j = 1; j <= k; j++) { if (dp.at(i + j)) { dp.at(i) = false; break; } } } for (int i = 0; i <= k; i++) { if (dp.at(i)) { std::cout << i << std::endl; } } }