Submission #858993

# Submission time Handle Problem Language Result Execution time Memory
858993 2023-10-09T14:13:02 Z Tenis0206 Calvinball championship (CEOI15_teams) C++11
20 / 100
1000 ms 856 KB
#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 time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 180 ms 420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1012 ms 344 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1048 ms 856 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1029 ms 600 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1034 ms 856 KB Time limit exceeded
2 Halted 0 ms 0 KB -