Submission #245692

#TimeUsernameProblemLanguageResultExecution timeMemory
245692yasseenkamelSkyscraper (JOI16_skyscraper)C++14
5 / 100
2077 ms384 KiB
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #pragma GCC optimize("-Ofast") #include <bits/stdc++.h> using namespace std; typedef int in; #define int long long const long double EPS=1e-9; const int MOD=1e9+7; const int N=1e6; int n,m,a[105]; bool ok(){ int sm = 0; for(int i = 0 ; i < n - 1 ; i ++){ sm += abs(a[i] - a[i + 1]); } return sm <= m; } in main(){ cin >> n >> m; for(int i = 0 ; i < n ; i ++){ cin >> a[i]; } sort(a,a + n); int ans = 0; do{ ans += ok(); } while(next_permutation(a,a + n)); cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...