Submission #886510

#TimeUsernameProblemLanguageResultExecution timeMemory
886510stefanneaguA Huge Tower (CEOI10_tower)C++17
20 / 100
1055 ms8872 KiB
#include <bits/stdc++.h> using namespace std; const int nmax = 1e6 + 1; int v[nmax], n, h, ans; bool f[nmax]; void dfs(int x, int cnt) { if(cnt == n) { ans ++; } for(int i = 1; i <= n; i ++) { if(!f[i] && v[x] + h >= v[i]) { f[i] = 1; dfs(i, cnt + 1); f[i] = 0; } } } int main() { cin >> n >> h; for(int i = 1; i <= n; i ++) { cin >> v[i]; } assert(n < 20); sort(v + 1, v + n + 1, greater<int>()); for(int i = 1; i <= n; i ++) { f[i] = 1; dfs(i, 1); f[i] = 0; } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...