답안 #972435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
972435 2024-04-30T12:19:48 Z LCJLY Asceticism (JOI18_asceticism) C++14
4 / 100
600 ms 432 KB
#include <bits/stdc++.h>
using namespace std;
	
#define int long long 
#define ld long double
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl;
#define show4(x,y) for(auto it:y) cout << it << " "; cout << #x << endl;
typedef pair<long long,long long>pii;
typedef pair<int,pii>pi2;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());

void solve(){
	int n,k;
	cin >> n >> k;
	int arr[n];
	for(int x=0;x<n;x++){
		arr[x]=x+1;
	}
	
	int counter=0;
	do{
		int cnt=0;
		for(int x=1;x<n;x++){
			if(arr[x]<arr[x-1]) cnt++;
		}
		if(cnt==k-1) counter++;
	}while(next_permutation(arr,arr+n));
	
	cout << counter;
}
 
int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//freopen("in.txt","r",stdin);
	//cin >> t;
	while(t--){
		solve();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 69 ms 348 KB Output is correct
3 Correct 57 ms 432 KB Output is correct
4 Correct 57 ms 356 KB Output is correct
5 Correct 57 ms 352 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 6 ms 356 KB Output is correct
8 Correct 1 ms 356 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 0 ms 356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 69 ms 348 KB Output is correct
3 Correct 57 ms 432 KB Output is correct
4 Correct 57 ms 356 KB Output is correct
5 Correct 57 ms 352 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 6 ms 356 KB Output is correct
8 Correct 1 ms 356 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 0 ms 356 KB Output is correct
11 Execution timed out 1065 ms 356 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 69 ms 348 KB Output is correct
3 Correct 57 ms 432 KB Output is correct
4 Correct 57 ms 356 KB Output is correct
5 Correct 57 ms 352 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 6 ms 356 KB Output is correct
8 Correct 1 ms 356 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 0 ms 356 KB Output is correct
11 Execution timed out 1065 ms 356 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 69 ms 348 KB Output is correct
3 Correct 57 ms 432 KB Output is correct
4 Correct 57 ms 356 KB Output is correct
5 Correct 57 ms 352 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 6 ms 356 KB Output is correct
8 Correct 1 ms 356 KB Output is correct
9 Correct 1 ms 352 KB Output is correct
10 Correct 0 ms 356 KB Output is correct
11 Execution timed out 1065 ms 356 KB Time limit exceeded
12 Halted 0 ms 0 KB -