結果
| 問題 | No.1313 N言っちゃダメゲーム (4) |
| コンテスト | |
| ユーザー |
penguinman
|
| 提出日時 | 2020-12-10 00:52:29 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 473 bytes |
| 記録 | |
| コンパイル時間 | 1,299 ms |
| コンパイル使用メモリ | 214,800 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-15 20:48:48 |
| 合計ジャッジ時間 | 2,573 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,K; cin>>N>>K;
string S; cin>>S; S="o"+S;
int last=N-1;
for(int i=N-1;i>=0;i--){
if(S[i]=='o') {last=i;break;}
}
int cnt=0;
for(int i=0;i<N;i++){
if(S[i]=='x') cnt++;
else cnt=0;
if(cnt==K){
last=i-K;
break;
}
}
for(int i=N-1;i>=0;i--){
if(last-i>K&&S[i]=='o') last=i;
}
cout<<last<<endl;
}
penguinman