Submission #1102836

#TimeUsernameProblemLanguageResultExecution timeMemory
1102836vjudge1Skyscraper (JOI16_skyscraper)C++17
5 / 100
2064 ms504 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() using LL = long long; int main() { cin.tie(nullptr) -> ios_base::sync_with_stdio(false); int tests = 1; // cin >> tests; while (tests--) { int n, k; cin >> n >> k; vector <int> v (n), other (n); for (auto &i : v) cin >> i; iota (all (other), 0); int ans = 0; do { int sum = 0; for (int i = 1; i < n; i++) sum += abs (v[other[i]] - v[other[i - 1]]); ans += sum <= k; } while (next_permutation (all (other))); cout << ans << '\n'; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...