結果
問題 | No.1313 N言っちゃダメゲーム (4) |
ユーザー | platinum |
提出日時 | 2020-05-28 02:31:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 1,518 ms |
コンパイル使用メモリ | 168,548 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 04:00:26 |
合計ジャッジ時間 | 2,625 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0; i<(int)(n); i++) using namespace std; const int Max_N=2e5; const int INF=1e9; int main(){ int N, K; cin >> N >> K; string S; cin >> S; assert(1<=K && K<N); assert(N<=Max_N); assert(S.size()==N-1); rep(i,N-1) assert(S[i]=='o' || S[i]=='x'); int ans=INF; for(int i=N-2; i>=0; i--){ if(S[i]=='x') continue; if(ans-i<=K) continue; ans=i; } if(ans+1>K) cout << 0 << endl; else cout << ans+1 << endl; return 0; }