Submission #1102836

# Submission time Handle Problem Language Result Execution time Memory
1102836 2024-10-19T04:45:13 Z vjudge1 Skyscraper (JOI16_skyscraper) C++17
5 / 100
2000 ms 504 KB
#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 time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2064 ms 504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 504 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Execution timed out 2064 ms 504 KB Time limit exceeded
12 Halted 0 ms 0 KB -