Submission #858993

#TimeUsernameProblemLanguageResultExecution timeMemory
858993Tenis0206Calvinball championship (CEOI15_teams)C++11
20 / 100
1071 ms856 KiB
#include <bits/stdc++.h> using namespace std; const int nmax = 1e4; int nr = 0; int n; int v[nmax + 5], sol[nmax + 5]; bool done = false; void Back(int k, int Max = 0) { if(done) { return; } if(k > n) { ++nr; done = true; for(int i=1; i<=n; i++) { if(sol[i] != v[i]) { done = false; } } return; } for(int i=1; i<=Max+1 && !done; i++) { sol[k] = i; Back(k + 1, max(Max, i)); } } int main() { #ifdef home freopen("nr.in","r",stdin); freopen("nr.out","w",stdout); #endif // home cin>>n; for(int i=1; i<=n; i++) { cin>>v[i]; } nr = 0; Back(1); cout<<nr<<'\n'; 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...