結果
| 問題 |
No.204 ゴールデン・ウィーク(2)
|
| コンテスト | |
| ユーザー |
ngtkana
|
| 提出日時 | 2020-03-23 12:26:29 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 733 bytes |
| コンパイル時間 | 2,195 ms |
| コンパイル使用メモリ | 196,464 KB |
| 最終ジャッジ日時 | 2025-01-09 09:44:34 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 22 WA * 22 RE * 2 |
ソースコード
#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(42);
for(lint i=14;i<28;i++){
char c;std::cin>>c;
a.at(i)=c=='o';
}
std::vector<lint>b;
for(lint i=0,j=1;j<42;j++){
if(j<42&&a.at(j-1)==a.at(j))continue;
b.push_back(j-i);
i=j;
}
lint sz=b.size();
lint ans=std::max(b.at(1),b.at(sz-2))+n;
for(lint i=2;i<sz-1;i+=2){
cmx(ans,b.at(i)<=n?b.at(i-1)+b.at(i)+b.at(i+1):n+std::max(b.at(i-1),b.at(i+1)));
}
std::cout<<ans<<'\n';
}
ngtkana