Submission #1118243

#TimeUsernameProblemLanguageResultExecution timeMemory
1118243vjudge1Skyscraper (JOI16_skyscraper)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; template <typename T> istream &operator>>(istream &in, vector<T> &arr) { for (T &el : arr) { in >> el; } return in; } int main() { constexpr int MOD = 1'000'000'007; int n, l, s, ans = 0; cin >> n >> l; vector<int> a(n); cin >> a; ranges::sort(a); do { s = 0; for (int i = 0; i < n - 1; i++) { s += abs(a[i] - a[i + 1]); } if (s <= l) { ans++; if (ans == MOD) { ans = 0; } } } while (ranges::next_permutation(a).found); cout << ans << '\n'; return 0; }

Compilation message (stderr)

skyscraper.cpp: In function 'int main()':
skyscraper.cpp:20:3: error: 'ranges' has not been declared
   20 |   ranges::sort(a);
      |   ^~~~~~
skyscraper.cpp:34:12: error: 'ranges' has not been declared
   34 |   } while (ranges::next_permutation(a).found);
      |            ^~~~~~