Submission #475236

# Submission time Handle Problem Language Result Execution time Memory
475236 2021-09-21T15:04:40 Z stefantaga Calvinball championship (CEOI15_teams) C++14
0 / 100
512 ms 680 KB
#include <bits/stdc++.h>
#define MOD 1000007
using namespace std;
long long sum,v[100005],n,i,maxi,din[2][100005],inainte,acum,j,din2[1000005],ceau[1000005];
int main()
{
    #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=1;i<=n;i++)
    {
        ceau[n-i]=maxi;
        maxi=max(maxi,v[i]);
    }
    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 (j==ceau[i])
            {
                din2[i]=din[acum][j];
            }
        }
    }
    maxi=0;
    for (i=1;i<=n;i++)
    {
        sum=(sum+((v[i]-1)*din2[n-i])%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 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 512 ms 624 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 109 ms 480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 445 ms 680 KB Output isn't correct
2 Halted 0 ms 0 KB -