結果

問題 No.411 昇順昇順ソート
ユーザー pekempey
提出日時 2016-08-12 22:32:28
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 452 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 1,788 ms
コンパイル使用メモリ 163,604 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-07 12:59:26
合計ジャッジ時間 5,073 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	int n, k;
	cin >> n >> k;

	int ans = 0;
	for (int i = 0; i < 1 << n; i++) {
		vector<int> a, b;
		for (int j = 0; j < n; j++) {
			if (i & 1 << j) {
				a.push_back(j);
			} else {
				b.push_back(j);
			}
		}
		if (a.empty() || b.empty()) continue;
		sort(a.begin(), a.end());
		sort(b.begin(), b.end());
		if (a.back() > b.front() && a[0] == k - 1) ans++;
	}
	cout << ans << endl;
}
0