結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー ngtkanangtkana
提出日時 2020-03-23 12:26:29
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 733 bytes
コンパイル時間 2,373 ms
コンパイル使用メモリ 201,884 KB
実行使用メモリ 5,332 KB
最終ジャッジ日時 2023-08-27 01:25:56
合計ジャッジ時間 3,879 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 AC 2 ms
4,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,380 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 WA -
testcase_31 RE -
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 WA -
testcase_35 AC 2 ms
4,384 KB
testcase_36 RE -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,384 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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';
}
0