結果

問題 No.411 昇順昇順ソート
ユーザー tabataba
提出日時 2017-05-18 22:42:41
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 693 bytes
コンパイル時間 886 ms
コンパイル使用メモリ 112,264 KB
実行使用メモリ 7,236 KB
最終ジャッジ日時 2023-10-18 23:16:42
合計ジャッジ時間 5,108 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cassert>
#include <random>
#include <vector>
#include <algorithm>
#include <array>
#include <functional>
#include <utility>
#include <regex>
#include <tuple>
#include <map>

using namespace std;
template<typename T>
T gcd(T a,T b){
	T c=a%b;
	if(c==0){
		return b;
	}
	return gcd(b,c);
}

int main(){
	int64_t n,k,cnt=0;
	-scanf("%ld%ld",&n,&k);
	k--;
	vector<int> t(n);
	for(int i=0;i<n;i++)t[i]=i;
	do{
		if(t[0]==k){
			int ac=0;
			for(int i=0;i<n-1;i++){
				if(t[i]>t[i+1]){
					if(ac++==1)break;
				}
			}
			if(ac==1){
				cnt++;
			}
		}
	}while(next_permutation(t.begin(),t.end()));
	printf("%ld\n",cnt);
	return 0;
}
0