結果

問題 No.1057 素敵な日
ユーザー heno239heno239
提出日時 2020-05-23 01:23:03
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,060 bytes
コンパイル時間 1,191 ms
コンパイル使用メモリ 113,020 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 22:11:35
合計ジャッジ時間 1,995 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 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 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<cassert>
#include<random>
#include<unordered_map>
#include<numeric>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define all(v) (v).begin(),(v).end()
#define stop char nyaa;cin>>nyaa;


using P = pair<int, int>;
using ll = long long;
using LP = pair<ll, ll>;

const ll inf = 1000000007;
const ll INF = inf * inf;









void solve() {
	int a, b; cin >> a >> b;
	vector <int> v;
	rep(i, a)v.push_back(0);
	rep(i, b)v.push_back(1);

	int ans = 0;
	do {
		int cnt = 0;
		rep(i, a + b - 1) {
			if (v[i] != v[i + 1])cnt++;
		}
		ans = max(ans, cnt);


	} while (next_permutation(all(v)));
	cout << ans << "\n";
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int t; cin >> t;rep(i, t)solve();
	solve();
	stop
	return 0;
}
0