結果

問題 No.1057 素敵な日
ユーザー Mister
提出日時 2020-04-28 16:39:11
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 75,948 KB
最終ジャッジ日時 2025-01-10 02:41:26
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    int a, b;
    std::cin >> a >> b;

    std::vector<int> xs(a + b, 1);
    for (int i = 0; i < a; ++i) xs[i] = 0;

    int ans = 0;
    do {
        int cnt = 0;
        for (int i = 1; i < a + b; ++i) {
            if (xs[i] != xs[i - 1]) ++cnt;
        }
        ans = std::max(ans, cnt);
    } while (std::next_permutation(xs.begin(), xs.end()));

    std::cout << ans << std::endl;
    return 0;
}
0