結果

問題 No.2035 Tunnel
ユーザー kkkkkkota
提出日時 2022-08-12 23:27:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 1,891 ms
コンパイル使用メモリ 194,052 KB
最終ジャッジ日時 2025-01-30 21:49:11
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 WA * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;


int main() {
    int a;
    string s;
    cin >> a >> s;

    for(int i=1; i<=a; i++){
        if(s[i-1]=='#'){
            s[i-1] = '1';
        } else {
            s[i-1] = '0';
        }     
    }

    bitset<64> bit(s);

    int cnt=0;
    while (bit.any())
    {
        bit.reset(0);
        bitset<64> ne  = bit;
        bitset<64> tmp = bit & (bit >> 1);
        ne &= (tmp << 1);
        tmp.flip();
        ne |= tmp & (bit >> 1);
        cnt++;
        bit = ne;
    }
    

    cout << cnt << endl;

}
0