結果

問題 No.2397 ω冪
ユーザー Cyanmond
提出日時 2023-07-28 23:57:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,116 bytes
コンパイル時間 2,095 ms
コンパイル使用メモリ 200,620 KB
最終ジャッジ日時 2025-02-15 20:45:58
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
// #include "atcoder/modint"

using i64 = long long;
// using Fp = atcoder::modint998244353;

int main() {
    std::string N, M;
    std::cin >> N >> M;
    if (N == M) {
        std::cout << "No" << std::endl;
        return 0;
    } else if (N == "0") {
        std::cout << "Yes" << std::endl;
        return 0;
    } else if (M == "0") {
        std::cout << "No" << std::endl;
        return 0;
    }

    std::vector<int> x, y;
    {
        int last = 0;
        for (int i = 0; i < (int)N.size() - 1; ++i) {
            if (N[i] == '1') {
                x.push_back(i - last);
                last = i + 1;
            }
        }
        x.push_back(N.size() - last);
    }
    {
        int last = 0;
        for (int i = 0; i < (int)M.size() - 1; ++i) {
            if (M[i] == '1') {
                y.push_back(i - last);
                last = i + 1;
            }
        }
        y.push_back(M.size() - last);
    }
    std::sort(x.begin(), x.end(), std::greater());
    std::sort(y.begin(), y.end(), std::greater());
    std::cout << (y > x ? "Yes" : "No") << std::endl;
}
0