답안 #304934

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
304934 2020-09-22T08:44:52 Z EMEJ Skyscraper (JOI16_skyscraper) C++11
5 / 100
2000 ms 384 KB
#include <bits/stdc++.h>

#define int long long
#define F first
#define S second
#define pb push_back
#define pii pair <int,int>
#define all(x) x.begin(),x.end()
#define SZ(x) (int)x.size()

using namespace std;

int32_t main(){
	ios::sync_with_stdio(0);cin.tie(0);
	int n,k;
	cin>>n>>k;
	int a[n];
	int cnt=0;
	for(int i=0;i<n;i++) cin>>a[i];
	sort(a,a+n);
	do{
		int sum=0;
		for(int i=1;i<n;i++) sum+=abs(a[i]-a[i-1]);
		if(sum<=k) cnt++;
	}while(next_permutation(a,a+n));
	cout<<cnt<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2076 ms 384 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 1 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 1 ms 384 KB Output is correct
11 Execution timed out 2076 ms 384 KB Time limit exceeded
12 Halted 0 ms 0 KB -