結果

問題 No.1313 N言っちゃダメゲーム (4)
ユーザー HaaHaa
提出日時 2020-12-10 18:23:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 566 bytes
コンパイル時間 1,596 ms
コンパイル使用メモリ 168,128 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 20:39:35
合計ジャッジ時間 2,361 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<n;i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=998244353;
constexpr ll INF=1e18;

int main(){
    int n, k; cin >> n >> k; n--;
    string s; cin >> s;
    reverse(ALL(s));
    REP(i,n){
        if(s[i]=='o'){
            if(n-i<=k){
                cout << n-i << endl;
                return 0;
            }
            i+=k;
        }
    }
    cout << 0 << endl;
    return 0;
}
0