結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2020-03-23 12:18:31 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 756 bytes |
コンパイル時間 | 2,310 ms |
コンパイル使用メモリ | 195,476 KB |
最終ジャッジ日時 | 2025-01-09 09:44:08 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 WA * 7 |
ソースコード
#include<bits/stdc++.h> using lint=long long; void cmx(lint&x,lint y){if(x<y)x=y;} int main(){ std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false); std::cout.setf(std::ios_base::fixed);std::cout.precision(15); lint n;std::cin>>n; std::vector<lint>a(16); for(lint i=1;i<=14;i++){ char c;std::cin>>c; a.at(i)=c=='o'; } std::vector<lint>b; for(lint i=0,j=1;j<=16;j++){ if(j<16&&a.at(j-1)==a.at(j))continue; b.push_back(j-i); i=j; } lint sz=b.size(); lint ans=0; for(lint i=1;i<sz;i+=2){ cmx(ans,b.at(i)+n); } for(lint i=2;i<sz-1;i+=2){ if(n<b.at(i))continue; cmx(ans,b.at(i-1)+b.at(i)+b.at(i+1)); } std::cout<<ans<<'\n'; }