結果
問題 | No.204 ゴールデン・ウィーク(2) |
ユーザー |
![]() |
提出日時 | 2020-04-11 12:21:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 1,528 ms |
コンパイル使用メモリ | 168,116 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-18 21:30:51 |
合計ジャッジ時間 | 3,032 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 46 |
ソースコード
#include <bits/stdc++.h> using namespace std; template<typename T> void chmax(T &a,T b){ if(a<b)a=b; } signed main(){ int d;cin>>d; string s,t;cin>>s>>t;s+=t; s="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"+s+"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; int ans=0; for(int i=0;i<s.size()-20;i++){ int tmp=0; t=s;for(int j=i;j<i+d&&t[j]=='x';j++)t[j]='o'; for(char p:t){ if(p=='o')chmax(ans,++tmp); else tmp=0; } } cout<<ans<<endl; }