結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
|
提出日時 | 2024-09-11 16:30:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 586 bytes |
コンパイル時間 | 1,964 ms |
コンパイル使用メモリ | 194,468 KB |
最終ジャッジ日時 | 2025-02-24 06:40:06 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; int cnt(string S){ int k=0,res=0; for(auto s:S){ if(s=='o')k++; else{ res=max(res,k); k=0; } } return max(res,k); } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int D; cin>>D; string S,T; cin>>S>>T; S+=T; int an=cnt(S); if(D!=0)for(int i=0;i<14-D+1;i++){ string NS=S; for(int j=i;j<i+D;j++){ NS[j]='o'; } an=max(an,cnt(NS)); } cout<<an<<endl; }