結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー 0w1
提出日時 2020-12-18 16:53:21
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 1,852 ms
コンパイル使用メモリ 198,296 KB
最終ジャッジ日時 2025-01-17 03:01:23
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);

  int N, K; { cin >> N >> K; }
  string S; { cin >> S; }

  queue<int> lque;
  vector<int> d(N); {
    for (int i = N - 1; ~i; --i) {
      while (lque.size() && i + K < lque.front()) lque.pop();
      if (i && S[i - 1] == 'x') continue;
      d[i] = lque.size() > 0;
      if (d[i] == 0) lque.push(i);
    }
  }

  if (d[0]) {
    for (; lque.size(); lque.pop()) cout << lque.front() << '\n';
  } else {
    cout << 0 << endl;
  }
}

0