Submission #475233

# Submission time Handle Problem Language Result Execution time Memory
475233 2021-09-21T15:00:58 Z stefantaga Calvinball championship (CEOI15_teams) C++14
30 / 100
1000 ms 588 KB
#include <bits/stdc++.h>
#define MOD 1000007
using namespace std;
long long sum,v[20005],fact[100005],n,i,maxi,din[2][100005],inainte,acum,j;
map <pair <long long,long long > , long long > m;
long long valoare(int x,int y)
{
    if (x==0)
    {
        return 1;
    }
    return y*valoare(x-1,y)+valoare(x-1,y+1);
}
int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(0);
    #ifdef HOME
    ifstream cin("date.in");
    ofstream cout("date.out");
    #endif // HOME
    cin>>n;
    for (i=1;i<=n;i++)
    {
        cin>>v[i];
    }
    maxi=0;
   /* for (i=0;i<=n+5;i++)
    {
        din[0][i]=1;
    }
    for (i=1;i<=n;i++)
    {
        inainte=1-i%2;
        acum=i%2;
        for (j=0;j<=n+5;j++)
        {
            din[acum][j]=((j*din[inainte][j])%MOD+din[inainte][j+1])%MOD;
            if (m[{i,j}]==1)
            {
                m[{i,j}]=din[acum][j];
            }
        }
    }*/
    maxi=0;
    for (i=1;i<=n;i++)
    {
        sum=(sum+((v[i]-1)*valoare(n-i,maxi))%MOD)%MOD;
        maxi=max(maxi,v[i]);
    }
    cout<<sum+1;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 204 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 588 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -