제출 #1325548

#제출 시각아이디문제언어결과실행 시간메모리
1325548riafhasan2010Skyscraper (JOI16_skyscraper)C++17
5 / 100
2094 ms332 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9 + 7; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, limit; cin >> n >> limit; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int ans = 0; sort(a.begin(), a.end()); do { int cur = 0; for (int i = 1; i < n; i++) { cur += abs(a[i] - a[i - 1]); } if (cur <= limit) { ans++; } } while (next_permutation(a.begin(), a.end())); cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...