結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2017-07-08 11:11:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 538 bytes |
コンパイル時間 | 1,477 ms |
コンパイル使用メモリ | 169,856 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 11:59:10 |
合計ジャッジ時間 | 2,662 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <bits/stdc++.h> #define REP(i,n,N) for(int i=(n);i<(int) N;i++) #define p(s) cout<<(s)<<endl using namespace std; int main() { int D; string s,s1,x; x="xxxxxxxxxxxxxx"; cin>>D>>s>>s1; s=x+s+s1+x; int ans=0; REP (i,0,s.size()-D+1) { int cnt = 0; int mx = 0; s1 = s; REP (j,0,D) { if (s1[j+i] == 'o') break; s1[j+i] = 'o'; } REP (j,0,s1.size()) { if (s1[j] == 'o') { cnt++; } else { mx = max(cnt, mx); cnt = 0; } } mx = max(cnt, mx); ans = max(ans, mx); } p(ans); return 0; }