結果

問題 No.2063 ±2^k operations (easy)
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-05-05 18:33:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 814 bytes
コンパイル時間 1,086 ms
コンパイル使用メモリ 110,704 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-02 13:03:58
合計ジャッジ時間 2,140 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,376 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 3 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 5 ms
5,376 KB
testcase_23 AC 4 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

vector<pair<char, long long>> encoded;

void encode(string &S){
    long long l = 0, r, N=S.size();
    while(l != N){
        r = l+1;
        while(r<N && S[l] == S[r]) r++;
        encoded.push_back(make_pair(S[l], r-l));
        l = r;
    }
}

int main(){

    ll N=0, M=0;
    string S;
    cin >> S;
    encode(S);
    for (auto [c, x] : encoded){
        if (c == '1'){
            M++;
            N += x;
        }
    }

    if ((M == 2 && N == 2) || (M == 1 && N >= 2)) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}
0