結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2018-08-06 17:08:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 719 bytes |
| コンパイル時間 | 1,699 ms |
| コンパイル使用メモリ | 169,116 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-19 18:17:10 |
| 合計ジャッジ時間 | 2,958 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 11 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
//INSERT ABOVE HERE
signed main(){
Int d;
cin>>d;
string s,t;
cin>>s>>t;
s+=t;
s=string(100,'x')+s+string(100,'x');
auto calc=
[](string s){
Int n=s.size();
Int res=0;
for(Int i=0;i<n;i++){
Int j=i;
while(j<n&&s[j]=='o') j++;
chmax(res,j-i);
}
return res;
};
Int n=s.size();
Int ans=0;
for(Int i=0;i<n;i++){
t=s;
for(Int j=0;j<d&&i+j<n;j++)
t[i+j]='o';
chmax(ans,calc(t));
}
cout<<ans<<endl;
return 0;
}
beet