結果

問題 No.204 ゴールデン・ウィーク(2)
ユーザー tetsuzuki1115
提出日時 2018-02-28 21:20:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 1,071 bytes
コンパイル時間 1,017 ms
コンパイル使用メモリ 84,464 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-21 15:29:23
合計ジャッジ時間 2,804 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 46
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    int D;
    cin >> D;
    string S[2];
    cin >> S[0] >> S[1];

    int X[14*3] = {0};
    for ( int i = 0; i < 7; i++ ) {
        if ( S[0][i] == 'o' ) { X[i+14] = 1; }
        if ( S[1][i] == 'o' ) { X[i+21] = 1; }
    }

    int ans = 0;
    for ( int i = 0; i+D-1 < 14*3; i++ ) {
        int Y[14*3];
        memcpy( Y, X, sizeof(Y) );
        for ( int j = 0; j < D; j++ ) {
            if ( Y[i+j] == 0 ) { Y[i+j] = 1; }
            else { break; }
        }

        int a = 0;
        int m = 0;
        
        for ( int j = 0; j < 14*3; j++ ) {
            if ( Y[j] ) {
                a++;
                m = max( m, a );
            }
            else { a = 0; }
        }
        ans = max( ans, m );
    }
    cout << ans << endl;

    return 0;
}
0