Submission #573470

#TimeUsernameProblemLanguageResultExecution timeMemory
573470lamA Huge Tower (CEOI10_tower)C++17
20 / 100
1088 ms468 KiB
#include <bits/stdc++.h> #define taskname "truth" #define maxn 110 using namespace std; int n,m; int a[maxn]; bool adj[maxn][maxn]; bool dau[maxn]; int x[maxn]; int ans=0; int mod=1e9+9; void xuly(int i) { for (int j=1; j<=n; j++) if (!dau[j]&&adj[x[i-1]][j]) { if (i<n) { dau[j]=true; x[i]=j; xuly(i+1); dau[j]=false; } else { ans++; } } } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); // freopen(taskname".in","r",stdin); // freopen(taskname".out","w",stdout); cin>>n>>m; for (int i=1; i<=n; i++) cin>>a[i]; for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) if (i!=j) adj[i][j]=((a[i]+m)>=a[j]); for (int i=1; i<=n; i++) { dau[i]=true; x[1]=i; xuly(2); dau[i]=false; } ans%=mod; cout<<ans; }
#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...