(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1118281

#TimeUsernameProblemLanguageResultExecution timeMemory
1118281vjudge1Skyscraper (JOI16_skyscraper)C++17
5 / 100
2057 ms512 KiB
#include <bits/stdc++.h> using namespace std; #define int long long void solve(){ int n, k; cin >> n >> k; int a[n]; for(int i = 0; i < n; ++i){ cin >> a[i]; } sort(a, a + n); int res = 0; do{ int sum = 0; bool check = true; for(int i = 1; i < n; ++i){ sum += abs(a[i] - a[i - 1]); if(sum > k){ check = false; break; } } if(check){ res++; } }while(next_permutation(a, a + n)); cout << res << endl; } signed main(){ int T = 1; while(T--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...